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

小程序自定义tabbar使用tabbar组件,控制台报错 Cannot read property 'height' of null #2188

Closed
osinglee opened this issue Mar 17, 2023 · 2 comments · Fixed by #2775

Comments

@osinglee
Copy link

NutUI scenes(nutui 场景)

小程序(@nutui/nutui-taro)

NutUI-vue version(nutui-vue 版本)

4.0.2

Vue version(vue 版本)

3.3.0-alpha.4

Operating environment(运行环境)

dev:weapp

Citation method(引用方式)

npm

Node version(node 版本)

16.16.0

Browser and its version(浏览器及其版本)

chrome

System and its version(系统及其版本)

macos 13

Taro environmental information(taro 环境信息)

Taro CLI 3.5.11 environment info:
System:
OS: macOS 13.0
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
Yarn: 1.22.19 - ~/.yarn/bin/yarn
npm: 8.18.0 - ~/.nvm/versions/node/v16.16.0/bin/npm

Reproduction link(重现链接)

nutui.jd.com/taro/vue/4x/

Steps to reproduce(重现步骤)

Cannot read property 'height' of null

setTimeout(() => {
          const query = Taro.createSelectorQuery();
          query.select(".nut-tabbar").boundingClientRect();
          query.exec((res) => {
            height.value = res[0].height;
          });
        }, 500);

微信小程序自定义tabbar在dom中跟 page平级,Taro.createSelectorQuery() 无法获取到 ".nut-tabbar" 节点。导致res为[null]

What is expected?(期望的结果是什么?)

Cannot read property 'height' of null

What is actually happening?(实际的结果是什么?)

Cannot read property 'height' of null

@w-zhCN
Copy link

w-zhCN commented Nov 28, 2023

怎么解决呢?

@ye21st
Copy link

ye21st commented Dec 20, 2023

怎么解决的呢

@eiinu eiinu linked a pull request Dec 20, 2023 that will close this issue
21 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants