parent
4a07432468
commit
c9d046a8e8
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div v-if="!item.hidden&&item.children" class="menu-wrapper">
|
||||
<div v-if="!item.hidden" class="menu-wrapper">
|
||||
|
||||
<template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow">
|
||||
<app-link :to="resolvePath(onlyOneChild.path)">
|
||||
|
@ -11,24 +11,12 @@
|
|||
|
||||
<el-submenu v-else ref="submenu" :index="resolvePath(item.path)">
|
||||
<template slot="title">
|
||||
<item v-if="item.meta" :icon="item.meta.icon" :title="generateTitle(item.meta.title)" />
|
||||
</template>
|
||||
|
||||
<template v-for="child in item.children" v-if="!child.hidden">
|
||||
<sidebar-item
|
||||
v-if="child.children&&child.children.length>0"
|
||||
:is-nest="true"
|
||||
:item="child"
|
||||
:key="child.path"
|
||||
:base-path="resolvePath(child.path)"
|
||||
class="nest-menu" />
|
||||
|
||||
<app-link v-else :to="resolvePath(child.path)" :key="child.name">
|
||||
<el-menu-item :index="resolvePath(child.path)">
|
||||
<item v-if="child.meta" :icon="child.meta.icon" :title="generateTitle(child.meta.title)" />
|
||||
</el-menu-item>
|
||||
</app-link>
|
||||
<item :icon="item.meta && item.meta.icon" :title="generateTitle(item.meta.title)" />
|
||||
</template>
|
||||
|
||||
<sidebar-item v-for="child in item.children" :is-nest="true" :item="child"
|
||||
:key="child.path" :base-path="resolvePath(child.path)" class="nest-menu">
|
||||
</sidebar-item>
|
||||
</el-submenu>
|
||||
|
||||
</div>
|
||||
|
@ -67,7 +55,7 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
hasOneShowingChild(children, parent) {
|
||||
hasOneShowingChild(children = [], parent) {
|
||||
const showingChildren = children.filter(item => {
|
||||
if (item.hidden) {
|
||||
return false
|
||||
|
|
Loading…
Reference in New Issue