Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
W
web-monitor
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
Administrator
web-monitor
Commits
73ff6645
Commit
73ff6645
authored
May 02, 2018
by
Pan
Committed by
花裤衩
May 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:[menu]: some bug in only has one showing child
parent
4ac03801
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
SidebarItem.vue
src/views/layout/components/Sidebar/SidebarItem.vue
+12
-1
No files found.
src/views/layout/components/Sidebar/SidebarItem.vue
View file @
73ff6645
...
...
@@ -2,7 +2,7 @@
<div
class=
"menu-wrapper"
>
<template
v-for=
"item in routes"
v-if=
"!item.hidden&&item.children"
>
<router-link
v-if=
"
item.children.length===1 && !item.children[0].children &&
!item.alwaysShow"
:to=
"item.path+'/'+item.children[0].path"
<router-link
v-if=
"
hasOneShowingChildren(item.children) && !item.children[0].children&&
!item.alwaysShow"
:to=
"item.path+'/'+item.children[0].path"
:key=
"item.children[0].name"
>
<el-menu-item
:index=
"item.path+'/'+item.children[0].path"
:class=
"
{'submenu-title-noDropdown':!isNest}">
<svg-icon
v-if=
"item.children[0].meta&&item.children[0].meta.icon"
:icon-class=
"item.children[0].meta.icon"
></svg-icon>
...
...
@@ -43,6 +43,17 @@ export default {
type
:
Boolean
,
default
:
false
}
},
methods
:
{
hasOneShowingChildren
(
children
)
{
const
showingChildren
=
children
.
filter
(
item
=>
{
return
!
item
.
hidden
})
if
(
showingChildren
.
length
===
1
)
{
return
true
}
return
false
}
}
}
</
script
>
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