|
|
@@ -0,0 +1,25 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <h1>Part2</h1>
|
|
|
+ <p>
|
|
|
+ defineProps 和 defineEmits 都是只能在
|
|
|
+ 中使用的编译器宏。<slot name="aa">1111</slot>他们不需要导入,且会随着 的处理过程一同被编译掉。
|
|
|
+ defineProps 接收与 props 选项相同的值,defineEmits 接收与 emits
|
|
|
+ 选项相同的值。
|
|
|
+ <br>
|
|
|
+ <br>
|
|
|
+ defineProps 和 defineEmits
|
|
|
+ 在选项传入后,<slot>2222</slot>会提供恰当的类型推导。 传入到 defineProps 和 defineEmits
|
|
|
+ 的选项会从 setup 中提升到模块的作用域。因此,传入的选项不能引用在 setup
|
|
|
+ 作用域中声明的局部变量。<slot name="cc">3333</slot>这样做会引起编译错误。但是,它可以引用导入的绑定,因为它们也在模块作用域内。
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" setup>
|
|
|
+import {ref,reactive} from "vue"
|
|
|
+
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+</style>
|