Usage 11 lifecycle functions of Vue

Life Cycle function instance (Official 11):
beforeCreate: Called after the Examples section (Events / life cycle) initialization is complete.
created: Called after initialization is complete external injection / two-way binding and the like.
beforeMount: executed before page rendering.
mounted: dom executed after mounting element to the page.

The first time the page is loaded, do not take this two hooks, only when the data changes will be implemented:
beforeUpdate: data change, not executed before re-rendering.
updated: executed after completion of rendering data.

We need to call the destruction of execution: $ vm the destroy ().
BeforeDestroy: executed before the instance is destroyed.
destroyed: after execution instance destroyed.

Guess you like

Origin www.cnblogs.com/ws-mzz/p/11260949.html