項(xiàng)目時(shí)vue2版本
1.安裝插件vetur
2.在vscdoe 設(shè)置文件中配置
{
"editor.formatOnSave": true,
"editor.tabSize": 2,
// 關(guān)閉 Volar,防止沖突
"volar.takeOverMode": false,
// Vetur 設(shè)置
"vetur.useWorkspaceDependencies": true,
"vetur.experimental.templateInterpolationService": true,
"vetur.validation.template": false,
"typescript.validate.enable": false,
"javascript.validate.enable": false,
// uni-app 設(shè)置
"uni-app": {
"useUniApp": true
},
"files.associations": {
"*.vue": "vue"
}
}

image.png
配置后發(fā)現(xiàn)還不生效
下一步
項(xiàng)目根目錄創(chuàng)建jsconfig.json文件
{
"compilerOptions": {
"target": "es2017",
"module": "esnext",
"baseUrl": "./",
"paths": {
"@/*": ["*"]
},
"types": ["vue/types/vue"],
"checkJs": false,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"skipLibCheck": true
},
"exclude": ["node_modules", "dist"]
}

image.png
此時(shí)已經(jīng)點(diǎn)擊可以跳轉(zhuǎn)到定義位置了。但是全局寫(xiě)的方法發(fā)現(xiàn)編輯器顯示紅線(xiàn)。

image.png
Property ‘xxxx' does not exist on type 'CombinedVueInstance<{ readyOnly: unknown; businessPrice: unknown; travelStaffInfo: any; } & Record<never, any> & Vue, object, object, object, Record<never, any>>. Vetur(2339)
解決:查看插件設(shè)置 取消勾選

image.png