vue2和vue3生命周期钩子函数对比图

vue2 -> vue3

触发条件

beforeCreate -> 使用 setup()

创建时运行

created -> 使用 setup()

创建时运行

beforeMount -> onBeforeMount

挂载DOM运行

mounted -> onMounted

挂载DOM运行

beforeUpdate -> onBeforeUpdate

响应数据修改时运行

updated -> onUpdated

响应数据修改时运行

beforeDestroy -> onBeforeUnmount

元素销毁前运行

destroyed -> onUnmounted

元素销毁前运行

activated -> onActivated

管理Keep-Alive组件

deactivated -> onDeactivated

管理Keep-Alive组件

errorCaptured -> onErrorCaptured

 


posted @ 2024-08-24 09:42  我用python写Bug  阅读(2)  评论(0编辑  收藏  举报