首页 > 其他 > 详细

父组件和子组件生命周期的顺序

时间:2020-07-20 01:13:04      阅读:76      评论:0      收藏:0      [点我收藏+]
  1. 当点击"change it "的时候,引起视图变化,触发beforeUpdate和Update

  2. 当点击"destroy parent1",引发父亲组件的beforeDestroy和destoryed

  3. 当点击“destory children1”,引发子组件的beforeDestroy和destoryed

结论:
parent beforeCreated
parent created
parent beforeMount
child beforeCreated
child created
child beforeMount
parent mounted
当引起视图变化后
parent beforeUpdate
child beforeUpdate
child Update
parent Update
当destroy parent组件,即点击"destory parent1"的时候
parent beforeDestroy
child beforeDestroy
child destroyed
parent destroyed
当destroy children组件,即点击"destory children1"的时候
parent beforeUpdate
child beforeDestroy
child destroyed
parent Update

去下方gitee地址下载,然后打开"生命周期顺序"中的html文件
https://gitee.com/yao_zhongqiang/study_git/tree/dev3

父组件和子组件生命周期的顺序

原文:https://www.cnblogs.com/listenMao/p/13341764.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!