Execution order of parent-child component lifecycle hook functions

In a single component, the execution order of hooks

Creation phase:
beforeCreate -> created -> beforeMount -> mounted
Update phase:
beforeUpdate -> updated
Destruction phase:
beforeDestroy -> destroyed

In parent-child components, the execution order of hooks

Creation phase:
parent beforeCreate -> parent created -> parent beforeMount -> child beforeCreate -> child created -> child beforeMount -> child mounted -> parent mounted update phase: parent beforeUpdate -> child beforeUpdate -> child updated ->
parent
updated
Destruction phase:
parent beforeDestroy -> child beforeDestroy -> child destroyed -> parent destroyed

Guess you like

Origin blog.csdn.net/qq_42816270/article/details/129962237