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

selectComponent获取实例有时候为null #11406

Closed
ChengTBC opened this issue Mar 7, 2022 · 2 comments
Closed

selectComponent获取实例有时候为null #11406

ChengTBC opened this issue Mar 7, 2022 · 2 comments

Comments

@ChengTBC
Copy link

ChengTBC commented Mar 7, 2022

相关平台:微信小程序

小程序基础库:未设置
使用框架:Taro v3.2.8 react

父组件const [polvyContent, setPolvyContent] = useState()

子组件 const { setPolvyContent } = props
useReady(() => {
const _page = Taro.getCurrentInstance().page.selectComponent('#polvyId')

console.log(_page, '_page')

setPolvyContent(_page)

})

期望结果:在父组件调用polvyContent相关api

实际结果:有时候是正常的,但有时这个console.log(_page, '_page')打印结果为null

环境信息
👽 Taro v3.2.8

Taro CLI 3.2.8 environment info:
System:
OS: Windows 10
Binaries:
Node: 14.16.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
npm: 6.14.12 - C:\Program Files\nodejs\npm.CMD

@taro-bot2
Copy link

taro-bot2 bot commented Mar 7, 2022

您的 Issue 没有按照规范从 Taro Issue Helper 创建,因此会被直接关闭。

维护开源项目是一项非常辛苦的工作,还请多多包涵。
了解为什么这么严格?

@taro-bot2 taro-bot2 bot closed this as completed Mar 7, 2022
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

No branches or pull requests

1 participant