vue3钩子函数的命名和vue2对比

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

猜你喜欢

转载自blog.csdn.net/qq_45061876/article/details/130129217
今日推荐