-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
props传递过去的值,视图显示正确,但onLoad中打印undefined,方法中使用也是undefined,bug千千万啊 #1462
Comments
你模板显示的是 label,打印的是id undefined 我都没懂你意思 |
打印label也是一样,模板可以显示正确,但在方法或生命周期onLoad中却拿不到label的值,打印label会是undefined |
你组件是遍历调用的? |
同问,解决了吗? |
产生的原因onLoad执行的时候,还没有数据,可能是涉及到一个生命周期的问题,可是wepy对生命周期并不友好,所以,啦啦啦 解决方案可以看一下官方文档$broadcast的部分 子组件
父组件
|
这几天也遇到了一样的问题,然后其实在文档里有写到:
所以props拿不到是必然的,我也被undefined困扰好久。 |
@wangwen1220 但这个解决方案是不是会传递冗余数据。 |
之前也遇到这个问题我的做法是,把要循环的数组传入组件,然后在组件里面repeat |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. 因为这个 Issue 最近没有任何有效回复,所以被自动标记为了 |
组件代码:
父组件代码:
The text was updated successfully, but these errors were encountered: