20. (vue3.x+vite) Execution order of Vue child components and parent components

Front-end technology community general directory (please check this blog before subscribing)

Example effect

Insert image description here

Vue3 child component and parent component execution order

(1) Parent component – ​​setup (beforeCreate, created was replaced in vue3)
(2) Parent component – ​​onBeforeMount
(3) Child component – ​​setup (beforeCreate, created was replaced in vue3)
(4) Child component – ​​onBeforeMount
(5) Child Component – ​​onMounted
(6) Parent component – ​​onMounted

Parent component code

<template>
  <div>
    <div>

Guess you like

Origin blog.csdn.net/m0_60387551/article/details/133137837