页面刷新vue的生命周期
时间: 2023-09-04 17:14:41 浏览: 103
页面刷新时,Vue实例的生命周期会重新开始。整个过程包括:创建阶段、挂载阶段、更新阶段和销毁阶段。在创建阶段,Vue组件开始初始化,触发beforeCreate和created钩子函数。在挂载阶段,Vue将模板编译成虚拟DOM,并将其挂载到真实的DOM上,触发beforeMount和mounted钩子函数。在更新阶段,当组件的数据发生变化时,触发beforeUpdate和updated钩子函数。在销毁阶段,当组件被销毁时,触发beforeDestroy和destroyed钩子函数。所以,页面刷新时,Vue实例的生命周期会重新开始,从创建阶段开始执行,然后再依次执行挂载、更新和销毁阶段的生命周期函数。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [vue知识(四)生命周期、钩子函数、路由](https://blog.csdn.net/weixin_65548623/article/details/127563205)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [vue基础--vue的生命周期](https://blog.csdn.net/qq_45870314/article/details/126019616)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文