Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taro.createSelectorQuery获取高度偶尔为null #7146

Closed
vscing opened this issue Jul 24, 2020 · 2 comments
Closed

Taro.createSelectorQuery获取高度偶尔为null #7146

vscing opened this issue Jul 24, 2020 · 2 comments
Labels
F-react Framework - React question Further information is requested T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@vscing
Copy link

vscing commented Jul 24, 2020

相关平台

微信小程序

小程序基础库: 2.12.0
使用框架: React

复现步骤

useReady(() => {
const query = Taro.createSelectorQuery()
query.select('#header').boundingClientRect(res => {
//获取导航栏高度
let { height } = res
console.log(height)
}).exec()
})

期望结果

每次打开都能获取到高度

实际结果

打开之后偶尔高度为null

环境信息

� Taro v3.0.2


  Taro CLI 3.0.2 environment info:
    System:
      OS: Windows 7
    Binaries:
      Node: 12.18.0 - D:\nodejs\node.EXE
      Yarn: 1.22.4 - C:\Users\Administrator\AppData\Roaming\npm\yarn.CMD
      npm: 6.14.5 - D:\nodejs\npm.CMD

@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Jul 24, 2020
@Chen-jj
Copy link
Contributor

Chen-jj commented Jul 24, 2020

@vscing Taro API 只是对原生 API 做了 promise 化,你可以使用 wx. 再试试

@Chen-jj Chen-jj added this to the 3.0.7 milestone Jul 30, 2020
@Chen-jj Chen-jj added the question Further information is requested label Jul 30, 2020
@Chen-jj Chen-jj modified the milestones: 3.0.7, 3.0.8 Aug 3, 2020
@Chen-jj Chen-jj modified the milestones: 3.0.8, 3.0.9 Aug 18, 2020
@Chen-jj
Copy link
Contributor

Chen-jj commented Sep 1, 2020

复现不了,还有问题的话提供一下可复现 demo 吧。

@Chen-jj Chen-jj closed this as completed Sep 1, 2020
@Chen-jj Chen-jj removed this from the 3.0.9 milestone Sep 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React question Further information is requested T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

2 participants