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

2018/08/31 关于父组件和子组件的生命周期 #31

Open
ChenPt opened this issue Aug 31, 2018 · 0 comments
Open

2018/08/31 关于父组件和子组件的生命周期 #31

ChenPt opened this issue Aug 31, 2018 · 0 comments
Labels
VUE Vue相关问题

Comments

@ChenPt
Copy link
Owner

ChenPt commented Aug 31, 2018

子组件总是会先于父组件挂载。
一个拥有子组件的组件的生命周期如下
父组件beforeCreate => 父组件Created =>父组件beforeMount=> 子组件beforeCreate => 子组件Created => 子组件beforeMount => 子组件Mounted => 父组件Mounted

需要注意,父组件的mounted不会承诺所有的子组件也都一起被挂载。所以如果需要视图完全渲染完毕,可以用vm.$nextTick来代替mounted

@ChenPt ChenPt added the VUE Vue相关问题 label Aug 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VUE Vue相关问题
Projects
None yet
Development

No branches or pull requests

1 participant