vue3——生命周期
vue2.x的生命周期:

-
beforeDestroy改名为beforeUnmount -
destroyed改名为
-
beforeCreate===>setup() -
created=======>setup() -
beforeMount===>onBeforeMount -
mounted=======>onMounted -
beforeUpdate===>onBeforeUpdate -
updated=======>onUpdated -
beforeUnmount==>onBeforeUnmount -
unmounted=====>
生命周期钩子是被暴露在vue实例上的,只需要调用使用就可以
我们需要将生命周期钩子导入项目,然后才能使用

在组合API中,使用setup()方法替换了beforeCreate和created,那么在这两个生命周期中的方法将放在setup中执行
浙公网安备 33010602011771号