uniapp的组件传值问题

经验证  父组件在onload传值给子组件是,模板能实时获取。在mounted中 只能获取最开始定义的值。另外如果子子组件重新在把传过来的值赋值给data的话,也不能实时获取,如要获取 则要在引入的时候加if

子组件获取父组件的异步数据  https://www.cnblogs.com/liujingjing/p/10737285.html

 

另外 在scroll-view中尽量避免使用画布canvas否则会出现各种问题,比如canvas点击不了。而且传值必须是监听,如果不用v-if则画布会出现display:none属性。真的好奇怪啊

 

附上Vue父子组件生命周期执行过程:

  • 加载渲染过程

  父beforeCreate->父created->父beforeMount->子beforeCreate->子created->子beforeMount->子mounted->父mounted

  • 子组件更新过程

  父beforeUpdate->子beforeUpdate->子updated->父updated

  • 父组件更新过程

  父beforeUpdate->父updated

  • 销毁过程

  父beforeDestroy->子beforeDestroy->子destroyed->父destroyed

posted @ 2020-06-03 16:41  牧码人hhom  阅读(4236)  评论(0编辑  收藏  举报