Vue.js-- life cycle

​​Here Insert Picture Description

Examples of the life cycle of vue

  • What is the life cycle: from creation Vue instance, to run, to destroy the period, always accompanied by a variety of events, which, collectively referred to as life cycle!
  • Lifecycle hook : is the alias of life cycle events only;
  • Lifecycle hook function = = life cycle life cycle events
  • The main function of the life cycle Category:
  • During the life cycle of creation functions:
    • beforeCreate: Just instance is created in memory, this time, there is no good data to initialize properties and methods
    • created: OK instance has been created in memory, this time data and methods have been created OK, this time has not yet begun to compile a template
    • beforeMount: At this point has been compiled template, but have not mounted to the page
    • mounted: At this point, has compiled template, mounted to the page specified container display
  • During the life cycle of the run function:
    • beforeUpdate: This function is executed before a status update, this time in the state value data is up to date, but the data displayed on the screen or old, because at this time has not yet begun to re-render a DOM node
    • updated: This function is called after the update is completed instance, data is displayed on the data values ​​in the state and interfaces, have completed the update, the interface has been re-rendered good!
  • During the life cycle of destruction function:
    • beforeDestroy: called before destroy instance. In this step, the instance is still fully available.
    • destroyed: Vue instance called after the destruction. After the call, everything will de-binding indication Vue instance, all event listeners will be removed, all the child instance will be destroyed.
Published 215 original articles · won praise 37 · views 80000 +

Guess you like

Origin blog.csdn.net/MirabelleZWH/article/details/100020611