Skip to content

Commit

Permalink
fix: 解决小程序下无法获取元素信息的问题
Browse files Browse the repository at this point in the history
相关问题:#1734
  • Loading branch information
robinv8 committed Jan 19, 2024
1 parent 009c2c2 commit 8927199
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
18 changes: 10 additions & 8 deletions packages/taro-ui/rn/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ function delayQuerySelector(
delayTime = 500
): Promise<any[]> {
return new Promise(resolve => {
const selector: SelectorQuery = Taro.createSelectorQuery()
delay(delayTime).then(() => {
selector
.select(selectorStr)
.boundingClientRect()
.exec((res: any[]) => {
resolve(res)
})
Taro.nextTick(() => {
const selector: SelectorQuery = Taro.createSelectorQuery()
delay(delayTime).then(() => {
selector
.select(selectorStr)
.boundingClientRect()
.exec((res: any[]) => {
resolve(res)
})
})
})
})
}
Expand Down
18 changes: 10 additions & 8 deletions packages/taro-ui/src/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ function delayQuerySelector(
delayTime = 500
): Promise<any[]> {
return new Promise(resolve => {
const selector: SelectorQuery = Taro.createSelectorQuery()
delay(delayTime).then(() => {
selector
.select(selectorStr)
.boundingClientRect()
.exec((res: any[]) => {
resolve(res)
})
Taro.nextTick(() => {
const selector: SelectorQuery = Taro.createSelectorQuery()
delay(delayTime).then(() => {
selector
.select(selectorStr)
.boundingClientRect()
.exec((res: any[]) => {
resolve(res)
})
})
})
})
}
Expand Down

0 comments on commit 8927199

Please sign in to comment.