All life cycle hook automatically bind this
context to an instance, so you can access the data on the properties and methods of operation. This means you can not use the arrow function to define a life cycle approach.
beforeCreate
After the initialization of example, this time can not access the data.
created
created hook function has access to data, the best place for Ajax hook function request, the request data returned can be placed directly in data.
beforeMount
It is called before beginning to mount: the associated render
function is first called.
The hook is not called during server-side rendering.
mounted
Have access to the dom, dom to operate
beforeUpdate
Called when the data update occurs before the virtual DOM patch. Here for access to existing DOM before updating, such as manual removal has been added event listeners.
The hook is not called during server-side rendering, since only the first time will be rendered on the server side.
updated
DOM data change caused the virtual re-rendering, after which it will call the hook.
Note: Updated does not promise all of the sub-components have also been redrawn together. If you want to wait until the entire view redraw is completed, you can use vm. $ NextTick replace updated
The hook is not called during server-side rendering.
beforeDestory
Called before destroy instance. In this step, the instance is still fully available.
The hook is not called during server-side rendering.
destoryed
Vue instance calls after the destruction. After the call, everything will de-binding indication Vue instance, all event listeners will be removed, all the grains of cases will be destroyed.
The hook is not called during server-side rendering.
nextTick