|
|
@@ -0,0 +1,29 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <h1>Props</h1>
|
|
|
+ <h2>展示:{{ x }}</h2>
|
|
|
+ <ul>
|
|
|
+ <li v-for="(item,index) in open" :key="index">
|
|
|
+ {{ item.name }}--{{ item.age }}
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts" setup>
|
|
|
+import {ref,reactive,withDefaults} from "vue"
|
|
|
+import {type aa } from "@/types/7";
|
|
|
+// 单纯的接受值
|
|
|
+// defineProps(['x','open'])
|
|
|
+// 限制类型
|
|
|
+defineProps<{open:aa}>();
|
|
|
+// 默认值
|
|
|
+// withDefaults(defineProps<{open:aa,x:number}>(),{
|
|
|
+// open:()=>[{name:"喜羊羊",age:7}],
|
|
|
+// x:12
|
|
|
+
|
|
|
+// })
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+</style>
|