所有的生命周期钩子自动绑定 this 上下文到实例中,因此可以访问数据,对属性和方法进行运算。这意味着不能使用箭头函数来定义一个生命周期方法
beforeCreate
created
beforeMount
mounted
beforeUpdate
updated
activated
deactivated
beforeDestroy
destroyed
errorCaptured
1、初始化执行的钩子
beforeCreate => 1、created => 2、beforeMount => 3、mounted => 4
1
2
3
par____1
par____2
par____3
child____1
child____2
child____3
child2____1
child2____2
child2____3
child2____4
child____4
par____4
4
2、数据更新时的钩子
beforeUpdate => 5、updated => 6
5
par____5
child____5
child____6
par____6
6
网友评论