报错
Type '{}' is not assignable to type '(props: Readonly<Props>) => object'. Type '{}' provides no match for the signature '(props: Readonly<Props>): object'.
报错时的代码
//props
interface Props {
mydata:object,
}
const props = withDefaults(defineProps<Props>(), {
mydata:{}
});
解决后的代码
//props
interface Props {
mydata: object;
}
const props = withDefaults(defineProps<Props>(), {
mydata: () => {
return {};
},
});
标签:mydata,withDefaults,object,vue3,ts,Readonly,报错,props
From: https://www.cnblogs.com/00544--/p/16704624.html