系统路径别名配置以及路径提示

This commit is contained in:
huangge1199 2024-11-28 10:01:56 +08:00
parent 6df44e6aaf
commit 3caa9d2429
5 changed files with 19 additions and 4 deletions

View File

@ -10,6 +10,7 @@
},
"dependencies": {
"@element-plus/icons-vue": "^2.3.1",
"@types/node": "^22.10.0",
"element-plus": "^2.8.8",
"vue": "^3.5.13",
"vue-router": "^4.5.0"

View File

@ -4,12 +4,12 @@ const routes: RouteRecordRaw[] = [
{
path: '/login',
name: 'Login',
component: ()=>import('../views/login/index.vue')
component: ()=>import('@/views/login/index.vue')
},
{
path: '/:pathMatch(.*)*',
name: '404',
component: ()=>import('../views/error/404.vue')
component: ()=>import('@/views/error/404.vue')
},
]
const router: Router = createRouter({

View File

@ -21,7 +21,11 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true,
"types": ["element-plus/global"]
"types": ["element-plus/global"],
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
}
},
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
}

View File

@ -19,7 +19,11 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true,
"types": ["element-plus/global"]
"types": ["element-plus/global"],
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
}
},
"include": ["vite.config.ts"]
}

View File

@ -1,7 +1,13 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
// https://vite.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
'@': resolve(__dirname, 'src')
}
}
})