What is the sequence of the execution of the created of the vue parent component and the mounted of the child component?

what is the order of execution of the created of the parent component and the mounted of the child component?
if there is in the created of the parent component, then will the created of the child component be executed before the child component mounted

Jun.08,2021

the order of execution is as follows:

  1. parent component created
  2. subcomponent created
  3. subcomponent mounted
  4. parent component mounted

if there are multiple subcomponents:

  1. after the parent component created hook ends, execute the created hook of the child component
  2. the created execution order of multiple child components is the DOM order of child components within the parent component
  3. the mounted order of multiple sub-components cannot be guaranteed, which is related to the complexity of the sub-components
  4. the parent component must not enter the mounted hook until all child components have finished the mounted hook

created is executed when it is created.
mounted is built to execute.
must be created first by the parent. Then create the children, and the children are not finished building. The father has to wait.


the created of the parent component and then the child component mounted


the parent component will not enter the mounted hook until all child components have finished mounted hook

Hello! The official website says, "Note that mounted does not promise that all child components will be mounted together." does this mean that the mounted of the parent component cannot be guaranteed after the mounted of the child component?

Menu