Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
najiu-frontend
najiu-admin-template
Commits
d52b0de8
Commit
d52b0de8
authored
Jul 02, 2021
by
无木
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(route): add `hidePathForChildren` in `meta`
添加`hidePathForChildren`选项用于在子菜单中隐藏本级path
parent
72ac240f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
menuHelper.ts
src/router/helper/menuHelper.ts
+1
-5
feat.ts
src/router/routes/modules/demo/feat.ts
+1
-0
vue-router.d.ts
types/vue-router.d.ts
+3
-0
No files found.
src/router/helper/menuHelper.ts
View file @
d52b0de8
...
@@ -9,10 +9,6 @@ export function getAllParentPath<T = Recordable>(treeData: T[], path: string) {
...
@@ -9,10 +9,6 @@ export function getAllParentPath<T = Recordable>(treeData: T[], path: string) {
return
(
menuList
||
[]).
map
((
item
)
=>
item
.
path
);
return
(
menuList
||
[]).
map
((
item
)
=>
item
.
path
);
}
}
function
isPlainPath
(
path
:
string
)
{
return
path
.
indexOf
(
'
:
'
)
===
-
1
;
}
function
joinParentPath
(
menus
:
Menu
[],
parentPath
=
''
)
{
function
joinParentPath
(
menus
:
Menu
[],
parentPath
=
''
)
{
for
(
let
index
=
0
;
index
<
menus
.
length
;
index
++
)
{
for
(
let
index
=
0
;
index
<
menus
.
length
;
index
++
)
{
const
menu
=
menus
[
index
];
const
menu
=
menus
[
index
];
...
@@ -24,7 +20,7 @@ function joinParentPath(menus: Menu[], parentPath = '') {
...
@@ -24,7 +20,7 @@ function joinParentPath(menus: Menu[], parentPath = '') {
menu
.
path
=
`
${
parentPath
}
/
${
menu
.
path
}
`
;
menu
.
path
=
`
${
parentPath
}
/
${
menu
.
path
}
`
;
}
}
if
(
menu
?.
children
?.
length
)
{
if
(
menu
?.
children
?.
length
)
{
joinParentPath
(
menu
.
children
,
isPlainPath
(
menu
.
path
)
?
menu
.
path
:
parentP
ath
);
joinParentPath
(
menu
.
children
,
menu
.
meta
?.
hidePathForChildren
?
parentPath
:
menu
.
p
ath
);
}
}
}
}
}
}
...
...
src/router/routes/modules/demo/feat.ts
View file @
d52b0de8
...
@@ -240,6 +240,7 @@ const feat: AppRouteModule = {
...
@@ -240,6 +240,7 @@ const feat: AppRouteModule = {
meta
:
{
meta
:
{
title
:
t
(
'
routes.demo.feat.tab
'
),
title
:
t
(
'
routes.demo.feat.tab
'
),
carryParam
:
true
,
carryParam
:
true
,
hidePathForChildren
:
true
,
},
},
children
:
[
children
:
[
{
{
...
...
types/vue-router.d.ts
View file @
d52b0de8
...
@@ -33,6 +33,9 @@ declare module 'vue-router' {
...
@@ -33,6 +33,9 @@ declare module 'vue-router' {
// Never show in menu
// Never show in menu
hideMenu
?:
boolean
;
hideMenu
?:
boolean
;
isLink
?:
boolean
;
isLink
?:
boolean
;
// only build for Menu
ignoreRoute
?:
boolean
;
ignoreRoute
?:
boolean
;
// Hide path for children
hidePathForChildren
?:
boolean
;
}
}
}
}
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