父组件还可以通过插槽 (slots) 将模板片段传递给子组件:
App.vue
<script setup>
import { ref } from 'vue'
import ChildComp from './ChildComp.vue'
const msg = ref('from parent')
</script>
<template>
<ChildComp>{{ msg }}</ChildComp>
</template>
ChildComp.vue,页面展示‘from parent’
<template>
<slot>Fallback content</slot>
</template>
标签:vue,插槽,ChildComp,012,msg,import
From: https://www.cnblogs.com/ayubene/p/18088817