vue3.0 life cycle
- setup() : Before starting to create components, execute beforeCreate and created. The data and method are created
- onBeforeMount() : The function executed before the component is mounted on the node.
- onMounted() : The function executed after the component is mounted.
- onBeforeUpdate(): The function executed before the component is updated.
- onUpdated(): A function executed after the component is updated.
- onBeforeUnmount(): The function executed before the component is unmounted.
- onUnmounted(): The function executed after the component is unmounted
- onActivated(): The component included in will have two more life cycle hook functions. Executed when activated.
- onDeactivated(): For example, switch from A component to B component, and execute when A component disappears.
- 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