dashengzi66 / note

学习笔记
0 stars 0 forks source link

生命周期 #19

Open dashengzi66 opened 2 years ago

dashengzi66 commented 2 years ago

单个组件生命周期钩子执行顺序

页面加载:beforeCreate -> created -> beforeMount -> mounted 页面关闭:beforeDestroy -> destroyed 页面数据改变:beforeUpdate -> updated

dashengzi66 commented 2 years ago

父子组件的生命周期钩子执行顺序

1.加载渲染过程 父beforeCreate->父created->父beforeMount->子beforeCreate->子created->子beforeMount->子mounted->父mounted

2.更新过程 父beforeUpdate->子beforeUpdate->子updated->父updated

3.销毁过程 父beforeDestroy->子beforeDestroy->子destroyed->父destroyed。