**
1.语法
**
<template>
<Foo></Foo>
</template>
<script setup>
//导入任意的组件就可以直接在 template 中使用
import Foo from "./components/Foo"
</script>
2. defineProps 用来接收父组件传来的props defineEmit 用来声明触发的事件
//子组件 msg.vue
<template>
<div>
{
{
msg }}
<button @click="onClick">点击按钮</button>
</div>
</template>
<script setup>
import {
defineProps , defineEmits } from 'vue'
let props = defineProps({
msg: String,
});
console.