1.在项目跟目录新增 tsconfig.js or jsconfig.json
{
"compilerOptions": {
"target": "ES6",
"module": "commonjs",
"allowSyntheticDefaultImports": true,
"allowJs": true,
"baseUrl": "./",
"paths": {
"@/*": ["src/*"]
}
},
"include": ["src/**/*"],
"exclude": ["node_modules", "build"]
}
jsconfig.json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
},
"target": "ES6",
"module": "commonjs",
"allowSyntheticDefaultImports": true
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}
2.安装vue-helper
3.安装Path Intellisense
4.在settings.json配置文件中配置
{
"vue-helper.componentIgnore": ["node_modules"],
"vue-helper.alias": {
"@": "src"
},
"vue-helper.componentPrefix": {
"alias": "@",
"path": "src"
},
"path-intellisense.extensionOnImport": true,
"path-intellisense.mappings": {
"@":"${workspaceRoot}/src"
}
}