vue3中可以继续使用vue2.x中的生命周期钩子,但是有两个被改名:
beforeDestroy改名为beforeUnmount
destroyed改名为unmounted
vue3也提供了Composition API形式的生命周期钩子,与vue2.x中钩子对应关系如下
beforeCreate =====setup()
created =========setup()
扫描二维码关注公众号,回复:
15286470 查看本文章
beforeMount=====onBeforeMount
mounted========onMounted
beforeUpdate====onBeforeUpdate
updated========onUpdated
beforeUnmount==onBeforeUnmount
unmounted=====onUnmounted
发布于 2022-08-27 09:02