备忘录而已:

<script setup lang="ts">
// import {PropType} from "vue"
export interface DataInfo{
id:number;
name:string
}
type Props = {
isObject?:DataInfo
}
// const props = defineProps({
// isObject: Object as PropType<DataInfo>,
// })
// // const props = defineProps<Props>()
// // let {id,name} = props
// console.log('props:',props);
// console.log('打印Props:',JSON.parse(JSON.stringify(props)))
const props = withDefaults(defineProps<Props>(), {
isObject: ()=> {return {name: '姓名',id: 12}}
})
console.log('打印Props:',JSON.parse(JSON.stringify(props)))
</script>

 

posted on 2023-03-10 13:47  仔仔爱学习  阅读(385)  评论(0编辑  收藏  举报