vue3.0 life cycle

vue3.0 life cycle

  1. setup() : Before starting to create components, execute beforeCreate and created. The data and method are created
  2. onBeforeMount() : The function executed before the component is mounted on the node.
  3. onMounted() : The function executed after the component is mounted.
  4. onBeforeUpdate(): The function executed before the component is updated.
  5. onUpdated(): A function executed after the component is updated.
  6. onBeforeUnmount(): The function executed before the component is unmounted.
  7. onUnmounted(): The function executed after the component is unmounted
  8. onActivated(): The component included in will have two more life cycle hook functions. Executed when activated.
  9. onDeactivated(): For example, switch from A component to B component, and execute when A component disappears.
  10. onErrorCaptured(): The hook function is activated when an exception from a descendant component is captured
Vue2--------------vue3
beforeCreate  -> setup()
created       -> setup()
beforeMount   -> onBeforeMount
mounted       -> onMounted
beforeUpdate  -> onBeforeUpdate
updated       -> onUpdated
beforeDestroy -> onBeforeUnmount
destroyed     -> onUnmounted
activated     -> onActivated
deactivated   -> onDeactivated
errorCaptured -> onErrorCaptured

Guess you like

Origin blog.csdn.net/Sunshinedada/article/details/128041610