Skip to content

Commit

Permalink
fix: 微信端dom信息获取优化
Browse files Browse the repository at this point in the history
  • Loading branch information
kongjing committed Mar 9, 2023
1 parent 219d8f2 commit c94eec4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 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 '@collapse-item-transition-duration' ease-in-out;
transition: all @collapse-item-transition-duration ease-in-out;
overflow: hidden;

&_wrapper {
Expand Down
7 changes: 6 additions & 1 deletion 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 Down

0 comments on commit c94eec4

Please sign in to comment.