Home > front end >  VUE life cycle of the hook and the execution process
VUE life cycle of the hook and the execution process

Time:10-12

1. BeforeCreate before (create) in observation data and initialization event has not yet started
2. Created (create) after complete observation data, the properties and methods of calculation, the initialization event, $el properties has not been displayed
Before 3. BeforeMount (load) before the start of the mount is called, the related render function is called, for the first time the instance has completed the following configuration: compile the template, the data inside the data and generate HTML templates, note at this point is not to mount the HTML page,
4. Mounted (load) was newly created in el vm. $el replacement, and mounted to the instance after the call, the instance has completed the following configuration: replace with compiled HTML content above el attribute points to the DOM object, complete in the template HTML rendering into the HTML page, the process for ajax interactions, (la loaded when used on realizing the list)
Before 5. BeforeUpdate (update) the data update before the call, in virtual DOM to render and patch before, can be further changes to the state, in the hook will not trigger additional heavy rendering process,
6. Updated (updated) in virtual due to data changes the DOM to render and patch after calls, call, DOM components has been updated, so you can perform depends on the operation of the DOM, in most cases, however, should be avoided during this time change state, because this may lead to update an infinite loop, the hook on the server side during the rendering is not invoked,
Before 7. BeforeDestroy (destroyed) call before instance destruction, instance still fully available,
After 8. Destroyed (destroyed) after instance destruction of calls, call, all event listeners will have been removed, all child instance will be destroyed, the hook on the server side during the rendering is not invoked,
  • Related