项目时vue2版本
1.安装插件vetur
2.在vscdoe 设置文件中配置
{
"editor.formatOnSave": true,
"editor.tabSize": 2,
// 关闭 Volar,防止冲突
"volar.takeOverMode": false,
// Vetur 设置
"vetur.useWorkspaceDependencies": true,
"vetur.experimental.templateInterpolationService": true,
"vetur.validation.template": false,
"typescript.validate.enable": false,
"javascript.validate.enable": false,
// uni-app 设置
"uni-app": {
"useUniApp": true
},
"files.associations": {
"*.vue": "vue"
}
}
image.png
配置后发现还不生效
下一步
项目根目录创建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
此时已经点击可以跳转到定义位置了。但是全局写的方法发现编辑器显示红线。
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)
解决:查看插件设置 取消勾选
image.png













网友评论