Commit cfbd52bbe7e49dae7a6fd4a4a67c2823d86fd258

Authored by Jim
Committed by GitHub
1 parent c0edd7b7

docs: 添加注释 (#1924)

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