index.ts
2.44 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import type { RouteRecordRaw } from "vue-router";
import { createRouter, createWebHistory } from "vue-router";
const routes: RouteRecordRaw[] = [
{
path: "/",
name: "Layout",
component: () => import("@/layouts/BasicLayout.vue"),
redirect: "/home",
children: [
{
path: "/home",
name: "Home",
component: () => import("@/views/Home.vue"),
redirect: "/home/dashboard",
meta: {
title: "首页",
},
children: [
{
path: "dashboard",
name: "Dashboard",
component: () => import("@/views/Dashboard.vue"),
meta: {
title: "工作台",
},
},
],
},
{
path: "/system/user",
name: "SystemUser",
component: () => import("@/views/system/User.vue"),
meta: {
title: "UI组件库",
},
},
{
path: "/pageHooks/index",
name: "PageHooks",
component: () => import("@/views/pageHooks/index.vue"),
meta: {
title: "Hooks 示例"
},
},
{
path: "/system/role",
name: "SystemRole",
component: () => import("@/views/system/Role.vue"),
meta: {
title: "角色管理",
},
},
{
path: "/system/menu",
name: "SystemMenu",
component: () => import("@/views/system/Menu.vue"),
meta: {
title: "菜单管理",
},
},
{
path: "/business/order/list",
name: "BusinessOrderList",
component: () => import("@/views/business/OrderList.vue"),
meta: {
title: "订单列表",
},
},
{
path: "/business/order/detail",
name: "BusinessOrderDetail",
component: () => import("@/views/business/OrderDetail.vue"),
meta: {
title: "订单详情",
},
},
{
path: "/business/product/list",
name: "BusinessProductList",
component: () => import("@/views/business/ProductList.vue"),
meta: {
title: "产品列表",
},
},
{
path: "/business/product/add",
name: "BusinessProductAdd",
component: () => import("@/views/business/ProductAdd.vue"),
meta: {
title: "添加产品",
},
},
{
path: "/:pathMatch(.*)*",
name: "NotFound",
component: () => import("@/views/NotFound.vue"),
meta: {
title: "404",
},
},
],
},
];
const router = createRouter({
history: createWebHistory(),
routes,
});
router.beforeEach((to: any, _from: any, next: any) => {
document.title = to.meta.title
? `${to.meta.title} - 后台管理系统`
: "后台管理系统";
next();
});
export default router;