生命周期

最后更新于:2022-04-02 08:13:32

>[success] # 生命周期 ~~~ 1.与 2.x 版本生命周期相对应的组合式 API beforeCreate -> 使用 setup() created -> 使用 setup() beforeMount -> onBeforeMount mounted -> onMounted beforeUpdate -> onBeforeUpdate updated -> onUpdated beforeDestroy -> onBeforeUnmount destroyed -> onUnmounted errorCaptured -> onErrorCaptured 2.新增的钩子函数 组合式 API 还提供了以下调试钩子函数: onRenderTracked onRenderTriggered ~~~ >[danger] ##### 案例 ~~~html ~~~ * 第一次执行 ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/d5/29/d5299c633a1b0bf94aa2ba5c4ceb9b15_165x143.png) * 点击更新按钮后执行 ![](https://docs.gechiui.com/gc-content/uploads/sites/kancloud/f8/b6/f8b66973ffc32bdd3279c230cf770eeb_190x101.png)
';