Skip to main content
vue3_Lifecycle Hooks

生命周期钩子

  • vue3.0中可以继续使用vue2.x中的生命周期钩子,但有两个被更名:
    beforeDestroy 改名为 beforeUnmount
    destroyed 改名为 unmounted

  • vue3.0也提供了Composition API 形式的生命周期钩子,与vue2.x中钩子对应关系如下:
        beforeCreate   = => setup()
        created        = => setup()
        beforeMount   = => onBeforeMount()
        mounted       = => onMounted()
        beforeUpdate  = => onBeforeUpdate()
        updated        = => onUpdated()
        beforeUnmount  = => onBeforeUnmount()
        unmounted      ==> onUnmounted()


漫步人生路Less than 1 minutevueLifecycle Hooks