一、父子通信
① props 父传子
父组件 props.vue 中
<template>
<h2>props:我是父组件</h2>
<hr>
<props-child msg="我是静态的数据" :num="num" :obj="{ name:'小黑',age:18 }">
</props-child>
</template>
<script setup lang="ts">
import { ref } from 'vue'
// props:可以实现父子组件的通讯,props数据还是只读的(不能修改!!)
import propsChild from './propsChild.vue';
let num = ref(521)
</script>
大约 21 分钟
