父组件调用子组件生命周期
时间: 2023-08-28 20:16:38 浏览: 109
在父组件调用子组件的生命周期中,首先父组件会调用子组件的beforeCreate和created钩子函数,然后父组件会调用子组件的beforeMount钩子函数,并将子组件渲染到父组件的模板中。渲染完成后,父组件会调用子组件的mounted钩子函数。当父组件的数据发生变化时,子组件会触发更新过程,此时会依次调用子组件的beforeUpdate和updated钩子函数。当父组件被销毁时,子组件也会随之销毁,此时会依次调用子组件的beforeDestroy和destroyed钩子函数。所以,在父组件调用子组件的生命周期中,先调用子组件的创建和挂载相关的钩子函数,然后调用子组件的更新和销毁相关的钩子函数。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [【Vue学习】Vue父子组件生命周期调用顺序](https://blog.csdn.net/zx1041561837/article/details/129203686)[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: 33.333333333333336%"]
- *2* [Vue父子组件生命周期执行顺序分析](https://blog.csdn.net/Model_yc/article/details/127392744)[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: 33.333333333333336%"]
- *3* [Vue中父子组件生命周期执行顺序小结](https://blog.csdn.net/qq_40922656/article/details/122065451)[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: 33.333333333333336%"]
[ .reference_list ]
阅读全文