-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
weapp ios 真机子组件不调用componentDidMount #4458
Comments
欢迎提交 Issue~ 如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏 如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。 Good luck and happy coding~ |
CC @Chen-jj |
@GaoYuJian 小程序的问题,这种写法会导致 ready 不触发,建议换种写法。 |
@Chen-jj 你好有什么替代写法吗,我们的实际场景是电商购物车,先清空购物车,再到商品详情添加商品到购物车 |
Hello~ 您的问题楼上已经有了确切的回答,如果没有更多的问题这个 issue 将在 15 天后被自动关闭。 如果您在这 15 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。 Good luck and happy coding~ |
@GaoYuJian 把逻辑放 componentWillMount |
@Chen-jj |
@GaoYuJian 加个变量控制一下展示时机试试 componentDidShow () {
this.setState({
show: true
})
}
componentDidHide () {
this.setState({
show: false
})
}
render () {
return (
<View className='index'>
{this.state.show &&
<View>
{
this.props.counter.testList.map((v, i) => {
return <CheckIcon onCheckChange={checked => this.onCheckChange(checked, i)} key={v.key} defaultChecked={v.checked} />
})
}
</View>
}
</View>
)
} |
问题描述
![屏幕快照 2019-09-12 19 23 39](https://user-images.githubusercontent.com/8776592/64780419-e971c680-d592-11e9-9819-713d88aeb135.png)
![屏幕快照 2019-09-12 19 23 49](https://user-images.githubusercontent.com/8776592/64780435-f1ca0180-d592-11e9-84b3-88a683dffc02.png)
页面结构如下图所示:
有俩个Tab页首页和店铺,店铺页面的组件在经过下面
复现步骤
的操作会触发bug,子组件componentDidMount不调用 (只有iOS真机会出现,微信小程序基础库版本2.8.2)复现步骤
调整二级页面
,设置店铺页面数据重新渲染子组件复现demo
系统信息
补充信息
通过调试发现是小程序原生组件的
ready
方法没有调用The text was updated successfully, but these errors were encountered: