1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
| import { RouteRecordRaw, createRouter, createWebHashHistory } from 'vue-router';
| import i18n from "/@/lang";
| // @ts-ignore
| import Layout from "/@/Layout/index.vue";
|
|
| // 扩展 RouteMeta 接口
| declare module 'vue-router' {
| interface RouteMeta {
| title: string;
| key: string;
| }
| }
|
|
| const routes: Array<RouteRecordRaw> = [
| {
| path: "/",
| name: "index",
| redirect: "/index",
| component: Layout,
| children: [
| {
| path: "/index",
| name: "indexPage",
| component: () => import("/@/views/index/index.vue"),
| meta: {
| title: i18n.global.t("router.login"),
| key: "index"
| }
| }
| ]
| },
| {
| path: '/login',
| name: 'login',
| component: () => import('/@/views/login/index.vue'),
| meta: {
| title: i18n.global.t("router.login"),
| key: "login"
| },
| },
| {
| path: '/401',
| name: 'noPower',
| component: () => import('/@/views/error/401.vue'),
| meta: {
| title: i18n.global.t("router.noPower"),
| key: "noPower"
| },
| },
| {
| path: '/:path(.*)*',
| name: 'notFound',
| component: () => import('/@/views/error/404.vue'),
| meta: {
| title: i18n.global.t("router.notFound"),
| key: "notFound"
| },
| },
| ];
|
|
| const router = createRouter({
| history: createWebHashHistory(),
| routes
| });
|
| export default router
|
|