vuebase --- 4. instance life cycle

1.beforeCreate

2.created

3.beforemounted

It is called before beginning to mount: the associated  render function is invoked for the first time

4.mounted

el It was newly created  vm.$el to replace, and mount the hook to call up after instance. If the root instance to mount the element within a document, as  mounted is called  vm.$el is also within the document.

5.beforeUpdate

Called when the data update occurs before the virtual DOM patch. Here for access to existing DOM before updating, such as manually removing event listeners have been added.

The hook is not called during server-side rendering, since only the first time will be rendered on the server

6.update

As the data changes lead to a virtual re-rendering and DOM patch, after which it will call the hook.

When this hook is called, DOM component has been updated, so you can now perform depend on DOM operations. However, in most cases, you should avoid changing the state during this period. If you want to change the state of a corresponding, generally best to use computed attribute or  watcher  instead.

Note that  updated not all commitments have also been redrawn subcomponents together. If you want to wait until the entire view are redrawn and ready to use  vm. $ NextTick  replaced updated

7.activated

Called when the component activation keep-alive.

The hook is not called during server-side rendering.

8.deactivated

Called when disabling keep-alive components.

The hook is not called during server-side rendering.

9.beforeDestroy

Called before destroy instance. In this step, the instance is still fully available.

The hook is not called during server-side rendering.

10.destroy

Vue instance calls 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.

The hook is not called during server-side rendering.

Guess you like

Origin www.cnblogs.com/xiao-peng-ji/p/11329938.html