
1653908241(1).jpg
找了一圈都沒有找到解決方案,問題最大的關(guān)鍵在于沒有相關(guān)的聲明文件,在ts項(xiàng)目里面,.ts文件是識(shí)別不了.vue文件,那么解決思路就是讓ts文件可以識(shí)別vue文件。處理方式:在tsconfig文件中include中添加需要解析的vue文件

2.png
我這里新建了一個(gè)shims .d.ts 文件(注意這里重要的是必須以.d.ts文件結(jié)尾),然后添加以下代碼
declare module "*.vue" {
import { defineComponent } from "vue";
const Component: ReturnType<typeof defineComponent>;
export default Component;
}