4、VUE生命周期

 

 

 

 

下面是分步骤解释vue生命周期

      创建vue对象过程还是比较繁琐的,所以创建vue对象是异步执行的。

      回调函数:beforeCreate

2、Observe Data

       监控模型层的数据

3、Init Events

        初始化事件

        回调函数:created

 

4、验证是否有eltemplate

       回调函数:beforeMount

5、Create vm.$el and replace el with it

       创建vue对象里的属性和方法

       回调函数:mountend

 

6、Mounted    

      初始化工作结束后,进入工作状态,我们看到他在监控视图层,监控模型层,数据变化要对应的变化,所以这是一个循环的。

       回调函数:beforeUpdate updated

 

       销毁时机:调用函数vm.$destroy

       回调函数:beforeDestroy

 

7、Teardown watchers,child components and event listeners

         销毁时,不再监控

8、Destroyed

       回调函数:destroyed

       此时vue对象被彻底的销毁。

 

相关文章:

  • 2021-11-24
  • 2021-06-22
猜你喜欢
  • 2021-08-25
  • 2021-05-22
  • 2021-05-28
  • 2021-09-14
  • 2021-12-05
  • 2021-04-10
相关资源
相似解决方案