[vue+typescript]Property or method "xxx" is not defined on the instance but referenced during render

项目里用到了vue+typescript遇到的坑,这里记录一下,代码如下:


就是prop里明明定义了 还是会报错


找了很久,后面才发现要加Component, 哪怕是空的也要加,加上就好了


另外补充一个额外问题,ts中String和string区别

在定义变量时,ts+vue 中prop里的定义要用string,小写,不然ts识别不了



你可能感兴趣的:([vue+typescript]Property or method "xxx" is not defined on the instance but referenced during render)