备忘录而已:
<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>
标签:console,log,props,ts,vue3.2,JSON,Props,id From: https://www.cnblogs.com/ch-zaizai/p/17203099.html