20.(vue3.x+vite)Vue子组件和父组件执行顺序

前端技术社区总目录(订阅之前请先查看该博客)

示例效果

在这里插入图片描述

Vue3子组件和父组件执行顺序

(1)父组件–setup(vue3中替换了beforeCreate,created)
(2)父组件–onBeforeMount
(3)子组件–setup(vue3中替换了beforeCreate,created)
(4)子组件–onBeforeMount
(5)子组件–onMounted
(6)父组件–onMounted

父组件代码

<template>
  <div>
    <div>

猜你喜欢

转载自blog.csdn.net/m0_60387551/article/details/133137837