1.Vs code商店搜索 Path Intellisense 插件安裝
2. 打開設置 - 首選項 - 搜索 Path Intellisense - 打開 settings.json ,添加:
"path-intellisense.mappings": { "@": "${workspaceRoot}/src" }
3.項目根目錄創建 jsconfig.json 文件,添加如下代碼:
{ "compilerOptions": { "target": "ES6", "module": "commonjs", "allowSyntheticDefaultImports": true, "baseUrl": "./", "paths": { "@/*": ["src/*"] } }, "exclude": [ "node_modules" ] }
4.重啟項目即可
