File tree Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change
1
+ 配置 ` vue3 ` 的基础的工程模板
2
+
1
3
### 创建工程
2
4
5
+ 执行下面的命令创建工程,根据提示选择 ` vue `
6
+
7
+ ```
8
+ npm init vite vue3-vite-js-template
9
+ ```
10
+
3
11
```
4
12
npm install eslint eslint-plugin-vue @babel/core @babel/eslint-parser -D
5
13
```
@@ -155,6 +163,8 @@ npx --no-install lint-staged
155
163
156
164
```
157
165
166
+ ### 创建别名
167
+
158
168
### router
159
169
160
170
安装 ` vue-router `
Original file line number Diff line number Diff line change 1
1
import { createRouter , createWebHashHistory } from 'vue-router'
2
- import Layout from '../layouts /Layout.vue'
2
+ import Layout from '@layout /Layout.vue'
3
3
const routes = [
4
4
{
5
5
path : '/' ,
@@ -10,7 +10,7 @@ const routes = [
10
10
{
11
11
path : 'home' ,
12
12
name : 'Home' ,
13
- component : ( ) => import ( '../pages /Home.vue' )
13
+ component : ( ) => import ( '@page /Home.vue' )
14
14
}
15
15
]
16
16
}
Original file line number Diff line number Diff line change 1
1
import { defineConfig } from 'vite'
2
2
import vue from '@vitejs/plugin-vue'
3
+ import path from 'path'
3
4
4
5
// https://vitejs.dev/config/
5
6
export default defineConfig ( {
6
- plugins : [ vue ( ) ]
7
+ plugins : [ vue ( ) ] ,
8
+ resolve : {
9
+ alias : {
10
+ '@' : path . resolve ( __dirname , 'src' ) ,
11
+ '@component' : path . resolve ( __dirname , 'src/components' ) ,
12
+ '@layout' : path . resolve ( __dirname , 'src/layouts' ) ,
13
+ '@page' : path . resolve ( __dirname , 'src/pages' )
14
+ }
15
+ }
7
16
} )
You can’t perform that action at this time.
0 commit comments