Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit dbc0b7e4
authored
Mar 29, 2025
by
anyup
Committed by
GitHub
Mar 29, 2025
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: route root.children duplicate problem (#5755)
Co-authored-by: anyup <anyupxing@163.com>
1 parent
aa290732
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletions
packages/effects/access/src/accessible.ts
packages/effects/access/src/accessible.ts
View file @
dbc0b7e
...
@@ -30,6 +30,9 @@ async function generateAccessible(
...
@@ -30,6 +30,9 @@ async function generateAccessible(
const
root
=
router
.
getRoutes
().
find
((
item
)
=>
item
.
path
===
'/'
);
const
root
=
router
.
getRoutes
().
find
((
item
)
=>
item
.
path
===
'/'
);
// 获取已有的路由名称列表
const
names
=
root
?.
children
?.
map
((
item
)
=>
item
.
name
)
??
[];
// 动态添加到router实例内
// 动态添加到router实例内
accessibleRoutes
.
forEach
((
route
)
=>
{
accessibleRoutes
.
forEach
((
route
)
=>
{
if
(
root
&&
!
route
.
meta
?.
noBasicLayout
)
{
if
(
root
&&
!
route
.
meta
?.
noBasicLayout
)
{
...
@@ -38,7 +41,10 @@ async function generateAccessible(
...
@@ -38,7 +41,10 @@ async function generateAccessible(
if
(
route
.
children
&&
route
.
children
.
length
>
0
)
{
if
(
route
.
children
&&
route
.
children
.
length
>
0
)
{
delete
route
.
component
;
delete
route
.
component
;
}
}
root
.
children
?.
push
(
route
);
// 根据router name判断,如果路由已经存在,则不再添加
if
(
!
names
?.
includes
(
route
.
name
))
{
root
.
children
?.
push
(
route
);
}
}
else
{
}
else
{
router
.
addRoute
(
route
);
router
.
addRoute
(
route
);
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment