Skip to content

Commit

Permalink
Merge branch 'main' of github:AntmJS/vantui
Browse files Browse the repository at this point in the history
  • Loading branch information
三少 committed Mar 14, 2023
2 parents 4fa41a6 + 0dfe4b7 commit f9ce13f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/vantui/src/collapse-item/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
.theme(line-height, '@collapse-item-content-line-height');
.theme(background-color, '@collapse-item-content-background-color');

transition: all 0.4s ease-in-out;
transition: all @collapse-item-transition-duration ease-in-out;
overflow: hidden;

&_wrapper {
Expand Down
11 changes: 8 additions & 3 deletions packages/vantui/src/collapse-item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ export function CollapseItem(

useEffect(() => {
setTimeout(() => {
getRect(null, `#content-class${curCompIndex}`).then((res: any) => {
// 微信端层级太深找不到元素信息 (https://taro-docs.jd.com/docs/optimized#1-%E5%85%A8%E5%B1%80%E9%85%8D%E7%BD%AE%E9%A1%B9-baselevel)
const targetId =
process.env.TARO_ENV === 'weapp'
? `.van-collapse >>> #content-class${curCompIndex}`
: `#content-class${curCompIndex}`
getRect(null, `${targetId}`).then((res: any) => {
if (res) {
setDomHeight(res.height)
nextTick(() => {
Expand All @@ -68,13 +73,13 @@ export function CollapseItem(
isFirstRender.current = false
nextActionTimeout.current = setTimeout(() => {
setCurrHeight('auto')
}, 400)
}, 200)
} else {
if (!isFirstRender.current) {
setCurrHeight(`${domHeight}px`)
nextActionTimeout.current = setTimeout(() => {
setCurrHeight('0px')
}, 300)
}, 200)
}
}
} else {
Expand Down

0 comments on commit f9ce13f

Please sign in to comment.