Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
cc1d2b19
authored
Aug 14, 2024
by
preschool
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎈
perf:优化动态路由在首次加载时未匹配导致警告、路由不存在时保留错误路径
parent
5a21c0e8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletions
+13
-1
src/router/modules/remaining.ts
+10
-0
src/store/modules/permission.ts
+3
-1
No files found.
src/router/modules/remaining.ts
View file @
cc1d2b19
...
@@ -593,6 +593,16 @@ const remainingRouter: AppRouteRecordRaw[] = [
...
@@ -593,6 +593,16 @@ const remainingRouter: AppRouteRecordRaw[] = [
}
}
}
}
]
]
},
{
path
:
'/:pathMatch(.*)*'
,
component
:
()
=>
import
(
'@/views/Error/404.vue'
),
name
:
''
,
meta
:
{
title
:
'404'
,
hidden
:
true
,
breadcrumb
:
false
}
}
}
]
]
...
...
src/store/modules/permission.ts
View file @
cc1d2b19
...
@@ -40,10 +40,12 @@ export const usePermissionStore = defineStore('permission', {
...
@@ -40,10 +40,12 @@ export const usePermissionStore = defineStore('permission', {
}
}
const
routerMap
:
AppRouteRecordRaw
[]
=
generateRoute
(
res
)
const
routerMap
:
AppRouteRecordRaw
[]
=
generateRoute
(
res
)
// 动态路由,404一定要放到最后面
// 动态路由,404一定要放到最后面
// preschooler:vue-router@4以后已支持静态404路由,此处可不再追加
this
.
addRouters
=
routerMap
.
concat
([
this
.
addRouters
=
routerMap
.
concat
([
{
{
path
:
'/:path(.*)*'
,
path
:
'/:path(.*)*'
,
redirect
:
'/404'
,
// redirect: '/404',
component
:
()
=>
import
(
'@/views/Error/404.vue'
),
name
:
'404Page'
,
name
:
'404Page'
,
meta
:
{
meta
:
{
hidden
:
true
,
hidden
:
true
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment