Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Fedex
/
EcomWeb
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
jinhui.wang
2026-03-30 13:31:18 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
63763c4d920d8c1f79353b166c1658f288d29d53
63763c4d
1 parent
d0091b3a
路由path空数据处理逻辑增加
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
10 deletions
src/store/modules/permission.js
src/store/modules/permission.js
View file @
63763c4
...
...
@@ -169,6 +169,10 @@ function setRoute(route, childrens) {
return
route
;
}
function
isValidMenuPath
(
p
)
{
return
p
!=
null
&&
String
(
p
).
trim
()
!==
""
;
}
function
routeItemInfo
(
data
)
{
const
routes
=
[
{
...
...
@@ -207,15 +211,22 @@ function routeItemInfo(data) {
];
data
.
forEach
((
item
)
=>
{
const
isParent
=
item
.
parentId
==
0
&&
item
.
children
.
length
==
0
;
const
route
=
{
path
:
item
.
path
,
component
:
"Layout"
,
alwaysShow
:
true
,
hidden
:
false
,
meta
:
{
title
:
item
.
name
,
icon
:
item
.
icon
},
children
:
!
isParent
?
item
.
children
.
map
((
child
)
=>
({
const
rawChildren
=
item
.
children
||
[];
const
isParent
=
item
.
parentId
==
0
&&
rawChildren
.
length
==
0
;
if
(
!
isValidMenuPath
(
item
.
path
))
{
console
.
warn
(
"[permission] skip menu item without path:"
,
item
);
return
;
}
const
childRoutes
=
!
isParent
?
rawChildren
.
filter
((
child
)
=>
{
if
(
!
isValidMenuPath
(
child
.
path
))
{
console
.
warn
(
"[permission] skip child menu without path:"
,
child
);
return
false
;
}
return
true
;
})
.
map
((
child
)
=>
({
path
:
child
.
path
,
component
:
`
${
child
.
path
}
`
,
hidden
:
false
,
...
...
@@ -230,7 +241,21 @@ function routeItemInfo(data) {
name
:
item
.
name
,
meta
:
{
title
:
item
.
name
,
icon
:
item
.
icon
||
""
},
},
],
];
if
(
!
isParent
&&
childRoutes
.
length
===
0
)
{
console
.
warn
(
"[permission] skip menu with no valid child paths:"
,
item
.
path
);
return
;
}
const
route
=
{
path
:
item
.
path
,
component
:
"Layout"
,
alwaysShow
:
true
,
hidden
:
false
,
meta
:
{
title
:
item
.
name
,
icon
:
item
.
icon
},
children
:
childRoutes
,
};
routes
.
push
(
route
);
});
...
...
Please
register
or
login
to post a comment