vue父子组件生命周期函数执行顺序

vue父组件加载和销毁执行最后一个钩子函数之前先执行一遍子组件的钩子:

1.加载

父:beforecreate-created-beforeMount-(子:beforecreate-created-beforeMount-mounted)-mounted

2.销毁

父:beforeDestroy--(子:beforeDestroy-destroyed)-destroyed

更新和加载销毁不一样,父组件更新不会执行子组件的钩子函数。

3更新

3.1父更新

父:beforeUpdate-updated

3.2子更新

父:beforeUpdate-(子beforeUpdate-updated)-updated

猜你喜欢

转载自www.cnblogs.com/liuboyuan/p/10081460.html