Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue的父组件和子组件生命周期钩子执行顺序是什么? #39

Open
GGXXMM opened this issue Aug 17, 2019 · 0 comments
Open
Labels

Comments

@GGXXMM
Copy link
Owner

GGXXMM commented Aug 17, 2019

1、组件渲染过程:

父beforeCreate -> 父created -> 父beforeMount -> 子beforeCreate -> 子created -> 子beforeMount -> 子mounted -> 父mounted

组件的调用顺序都是先父后子,渲染完成顺序是先子后父

2、组件更新过程:

父beforeUpdate -> 子beforeUpdate -> 子updated -> 父updated

3、组件销毁过程:

父beforeDestory -> 子beforeDestroy -> 子destroyed -> 父destroyed

组件销毁操作是先父后子,销毁完成顺序是先子后父

总结: 从外到内,再从内到外

@GGXXMM GGXXMM added the vue label Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant