File tree Expand file tree Collapse file tree 8 files changed +86
-31
lines changed Expand file tree Collapse file tree 8 files changed +86
-31
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ export function setupElegantRouter() {
8
8
base : 'src/layouts/base-layout/index.vue' ,
9
9
blank : 'src/layouts/blank-layout/index.vue'
10
10
} ,
11
+ customRoutes : {
12
+ names : [ 'exception_403' , 'exception_404' , 'exception_500' ]
13
+ } ,
11
14
routePathTransformer ( routeName , routePath ) {
12
15
const key = routeName as RouteKey ;
13
16
Original file line number Diff line number Diff line change 60
60
"vue-router" : " 4.2.5"
61
61
},
62
62
"devDependencies" : {
63
- "@elegant-router/vue" : " 0.3.2 " ,
63
+ "@elegant-router/vue" : " 0.3.4 " ,
64
64
"@iconify/json" : " 2.2.170" ,
65
65
"@sa/scripts" : " workspace:*" ,
66
66
"@sa/uno-preset" : " workspace:*" ,
Original file line number Diff line number Diff line change @@ -121,7 +121,11 @@ const local: App.I18n.Schema = {
121
121
'multi-menu_first_child' : 'Menu One Child' ,
122
122
'multi-menu_second' : 'Menu Two' ,
123
123
'multi-menu_second_child' : 'Menu Two Child' ,
124
- 'multi-menu_second_child_home' : 'Menu Two Child Home'
124
+ 'multi-menu_second_child_home' : 'Menu Two Child Home' ,
125
+ exception : 'Exception' ,
126
+ exception_403 : '403' ,
127
+ exception_404 : '404' ,
128
+ exception_500 : '500'
125
129
} ,
126
130
page : {
127
131
login : {
Original file line number Diff line number Diff line change @@ -121,7 +121,11 @@ const local: App.I18n.Schema = {
121
121
'multi-menu_first_child' : '菜单一子菜单' ,
122
122
'multi-menu_second' : '菜单二' ,
123
123
'multi-menu_second_child' : '菜单二子菜单' ,
124
- 'multi-menu_second_child_home' : '菜单二子菜单首页'
124
+ 'multi-menu_second_child_home' : '菜单二子菜单首页' ,
125
+ exception : '异常页' ,
126
+ exception_403 : '403' ,
127
+ exception_404 : '404' ,
128
+ exception_500 : '500'
125
129
} ,
126
130
page : {
127
131
login : {
Original file line number Diff line number Diff line change @@ -143,6 +143,10 @@ function transformElegantRouteToVueRoute(
143
143
const routeMap : RouteMap = {
144
144
"root" : "/" ,
145
145
"not-found" : "/:pathMatch(.*)*" ,
146
+ "exception" : "/exception" ,
147
+ "exception_403" : "/exception/403" ,
148
+ "exception_404" : "/exception/404" ,
149
+ "exception_500" : "/exception/500" ,
146
150
"403" : "/403" ,
147
151
"404" : "/404" ,
148
152
"500" : "/500" ,
Original file line number Diff line number Diff line change @@ -23,6 +23,49 @@ const customRoutes: CustomRoute[] = [
23
23
title : 'not-found' ,
24
24
constant : true
25
25
}
26
+ } ,
27
+ {
28
+ name : 'exception' ,
29
+ path : '/exception' ,
30
+ component : 'layout.base' ,
31
+ meta : {
32
+ title : 'exception' ,
33
+ i18nKey : 'route.exception' ,
34
+ icon : 'ant-design:exception-outlined' ,
35
+ order : 7
36
+ } ,
37
+ children : [
38
+ {
39
+ name : 'exception_403' ,
40
+ path : '/exception/403' ,
41
+ component : 'view.403' ,
42
+ meta : {
43
+ title : 'exception_403' ,
44
+ i18nKey : 'route.exception_403' ,
45
+ icon : 'ic:baseline-block'
46
+ }
47
+ } ,
48
+ {
49
+ name : 'exception_404' ,
50
+ path : '/exception/404' ,
51
+ component : 'view.404' ,
52
+ meta : {
53
+ title : 'exception_404' ,
54
+ i18nKey : 'route.exception_404' ,
55
+ icon : 'ic:baseline-web-asset-off'
56
+ }
57
+ } ,
58
+ {
59
+ name : 'exception_500' ,
60
+ path : '/exception/500' ,
61
+ component : 'view.500' ,
62
+ meta : {
63
+ title : 'exception_500' ,
64
+ i18nKey : 'route.exception_500' ,
65
+ icon : 'ic:baseline-wifi-off'
66
+ }
67
+ }
68
+ ]
26
69
}
27
70
] ;
28
71
Original file line number Diff line number Diff line change @@ -17,6 +17,10 @@ declare module "@elegant-router/types" {
17
17
export type RouteMap = {
18
18
"root" : "/" ;
19
19
"not-found" : "/:pathMatch(.*)*" ;
20
+ "exception" : "/exception" ;
21
+ "exception_403" : "/exception/403" ;
22
+ "exception_404" : "/exception/404" ;
23
+ "exception_500" : "/exception/500" ;
20
24
"403" : "/403" ;
21
25
"404" : "/404" ;
22
26
"500" : "/500" ;
@@ -54,6 +58,10 @@ declare module "@elegant-router/types" {
54
58
RouteKey ,
55
59
| "root"
56
60
| "not-found"
61
+ | "exception"
62
+ | "exception_403"
63
+ | "exception_404"
64
+ | "exception_500"
57
65
> ;
58
66
59
67
/**
@@ -84,6 +92,7 @@ declare module "@elegant-router/types" {
84
92
CustomRouteKey ,
85
93
| "root"
86
94
| "not-found"
95
+ | "exception"
87
96
> ;
88
97
89
98
/**
@@ -113,6 +122,9 @@ declare module "@elegant-router/types" {
113
122
CustomRouteKey ,
114
123
| "root"
115
124
| "not-found"
125
+ | "exception_403"
126
+ | "exception_404"
127
+ | "exception_500"
116
128
> ;
117
129
118
130
/**
@@ -241,7 +253,7 @@ declare module "@elegant-router/types" {
241
253
name : K ;
242
254
path : RouteMap [ K ] ;
243
255
component : `layout.${RouteLayout } `;
244
- children : ( CustomCenterLevelRoute < GetChildRouteKey < K > > | CustomLastLevelRoute < K > ) [ ] ;
256
+ children : ( CustomCenterLevelRoute < GetChildRouteKey < K > > | CustomLastLevelRoute < GetChildRouteKey < K > > ) [ ] ;
245
257
}
246
258
: never ;
247
259
You can’t perform that action at this time.
0 commit comments