Commit cfbd52bbe7e49dae7a6fd4a4a67c2823d86fd258
Committed by
GitHub
1 parent
c0edd7b7
docs: 添加注释 (#1924)
Showing
4 changed files
with
15 additions
and
0 deletions
.gitignore
src/main.ts
@@ -19,28 +19,37 @@ async function bootstrap() { | @@ -19,28 +19,37 @@ async function bootstrap() { | ||
19 | const app = createApp(App); | 19 | const app = createApp(App); |
20 | 20 | ||
21 | // Configure store | 21 | // Configure store |
22 | + // 配置 store | ||
22 | setupStore(app); | 23 | setupStore(app); |
23 | 24 | ||
24 | // Initialize internal system configuration | 25 | // Initialize internal system configuration |
26 | + // 初始化内部系统配置 | ||
25 | initAppConfigStore(); | 27 | initAppConfigStore(); |
26 | 28 | ||
27 | // Register global components | 29 | // Register global components |
30 | + // 注册全局组件 | ||
28 | registerGlobComp(app); | 31 | registerGlobComp(app); |
29 | 32 | ||
30 | // Multilingual configuration | 33 | // Multilingual configuration |
34 | + // 多语言配置 | ||
31 | // Asynchronous case: language files may be obtained from the server side | 35 | // Asynchronous case: language files may be obtained from the server side |
36 | + // 异步案例:语言文件可能从服务器端获取 | ||
32 | await setupI18n(app); | 37 | await setupI18n(app); |
33 | 38 | ||
34 | // Configure routing | 39 | // Configure routing |
40 | + // 配置路由 | ||
35 | setupRouter(app); | 41 | setupRouter(app); |
36 | 42 | ||
37 | // router-guard | 43 | // router-guard |
44 | + // 路由守卫 | ||
38 | setupRouterGuard(router); | 45 | setupRouterGuard(router); |
39 | 46 | ||
40 | // Register global directive | 47 | // Register global directive |
48 | + // 注册全局指令 | ||
41 | setupGlobDirectives(app); | 49 | setupGlobDirectives(app); |
42 | 50 | ||
43 | // Configure global error handling | 51 | // Configure global error handling |
52 | + // 配置全局错误处理 | ||
44 | setupErrorHandle(app); | 53 | setupErrorHandle(app); |
45 | 54 | ||
46 | // https://next.router.vuejs.org/api/#isready | 55 | // https://next.router.vuejs.org/api/#isready |
src/router/index.ts
@@ -14,9 +14,13 @@ const getRouteNames = (array: any[]) => | @@ -14,9 +14,13 @@ const getRouteNames = (array: any[]) => | ||
14 | getRouteNames(basicRoutes); | 14 | getRouteNames(basicRoutes); |
15 | 15 | ||
16 | // app router | 16 | // app router |
17 | +// 创建一个可以被 Vue 应用程序使用的路由实例 | ||
17 | export const router = createRouter({ | 18 | export const router = createRouter({ |
19 | + // 创建一个 hash 历史记录。 | ||
18 | history: createWebHashHistory(import.meta.env.VITE_PUBLIC_PATH), | 20 | history: createWebHashHistory(import.meta.env.VITE_PUBLIC_PATH), |
21 | + // 应该添加到路由的初始路由列表。 | ||
19 | routes: basicRoutes as unknown as RouteRecordRaw[], | 22 | routes: basicRoutes as unknown as RouteRecordRaw[], |
23 | + // 是否应该禁止尾部斜杠。默认为假 | ||
20 | strict: true, | 24 | strict: true, |
21 | scrollBehavior: () => ({ left: 0, top: 0 }), | 25 | scrollBehavior: () => ({ left: 0, top: 0 }), |
22 | }); | 26 | }); |
src/router/routes/index.ts
@@ -37,6 +37,7 @@ export const LoginRoute: AppRouteRecordRaw = { | @@ -37,6 +37,7 @@ export const LoginRoute: AppRouteRecordRaw = { | ||
37 | }; | 37 | }; |
38 | 38 | ||
39 | // Basic routing without permission | 39 | // Basic routing without permission |
40 | +// 未经许可的基本路由 | ||
40 | export const basicRoutes = [ | 41 | export const basicRoutes = [ |
41 | LoginRoute, | 42 | LoginRoute, |
42 | RootRoute, | 43 | RootRoute, |