就是代码写的不规范
报错写法
import {Setting} from '@element-plus/icons-vue'
import { defineProps ,withDefaults } from 'vue'
import {PiProject} from '@/types/Project'
interface ProjectCardProps{
project:PiProject
}
const props = defineProps<ProjectCardProps>();
withDefaults(props,{
project:{}
} )
返回值得是一个函数
正确写法
import {Setting} from '@element-plus/icons-vue'
import { defineProps ,withDefaults } from 'vue'
import {PiProject} from '@/types/Project'
interface ProjectCardProps{
project:PiProject
}
const props = defineProps<ProjectCardProps>();
withDefaults(props,{
project:():PiProject=>({
} as PiProject)
} )
标签:Vue,vue,withDefaults,project,PiProject,Typescript,props,import
From: https://www.cnblogs.com/pphboy/p/17344270.html