|
@@ -1,33 +1,25 @@
|
1
|
1
|
<template>
|
2
|
|
- <div v-if="!item.hidden&&item.children" class="menu-wrapper">
|
|
2
|
+ <div v-if="!item.hidden" class="menu-wrapper">
|
3
|
3
|
|
4
|
4
|
<template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow">
|
5
|
5
|
<app-link :to="resolvePath(onlyOneChild.path)">
|
6
|
6
|
<el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}">
|
7
|
|
- <item v-if="onlyOneChild.meta" :icon="onlyOneChild.meta.icon||item.meta.icon" :title="onlyOneChild.meta.title" />
|
|
7
|
+ <item :meta="Object.assign({},item.meta,onlyOneChild.meta)" />
|
8
|
8
|
</el-menu-item>
|
9
|
9
|
</app-link>
|
10
|
10
|
</template>
|
11
|
11
|
|
12
|
|
- <el-submenu v-else :index="resolvePath(item.path)">
|
|
12
|
+ <el-submenu v-else ref="subMenu" :index="resolvePath(item.path)">
|
13
|
13
|
<template slot="title">
|
14
|
|
- <item v-if="item.meta" :icon="item.meta.icon" :title="item.meta.title" />
|
15
|
|
- </template>
|
16
|
|
-
|
17
|
|
- <template v-for="child in item.children" v-if="!child.hidden">
|
18
|
|
- <sidebar-item
|
19
|
|
- v-if="child.children&&child.children.length>0"
|
20
|
|
- :is-nest="true"
|
21
|
|
- :item="child"
|
22
|
|
- :key="child.path"
|
23
|
|
- :base-path="resolvePath(child.path)"
|
24
|
|
- class="nest-menu" />
|
25
|
|
- <app-link v-else :to="resolvePath(child.path)" :key="child.name">
|
26
|
|
- <el-menu-item :index="resolvePath(child.path)">
|
27
|
|
- <item v-if="child.meta" :icon="child.meta.icon" :title="child.meta.title" />
|
28
|
|
- </el-menu-item>
|
29
|
|
- </app-link>
|
|
14
|
+ <item :meta="item.meta" />
|
30
|
15
|
</template>
|
|
16
|
+ <sidebar-item
|
|
17
|
+ v-for="child in item.children"
|
|
18
|
+ :is-nest="true"
|
|
19
|
+ :item="child"
|
|
20
|
+ :key="child.path"
|
|
21
|
+ :base-path="resolvePath(child.path)"
|
|
22
|
+ class="nest-menu" />
|
31
|
23
|
</el-submenu>
|
32
|
24
|
|
33
|
25
|
</div>
|
|
@@ -64,7 +56,7 @@ export default {
|
64
|
56
|
return {}
|
65
|
57
|
},
|
66
|
58
|
methods: {
|
67
|
|
- hasOneShowingChild(children, parent) {
|
|
59
|
+ hasOneShowingChild(children = [], parent) {
|
68
|
60
|
const showingChildren = children.filter(item => {
|
69
|
61
|
if (item.hidden) {
|
70
|
62
|
return false
|
|
@@ -89,13 +81,10 @@ export default {
|
89
|
81
|
return false
|
90
|
82
|
},
|
91
|
83
|
resolvePath(routePath) {
|
92
|
|
- if (this.isExternalLink(routePath)) {
|
|
84
|
+ if (isExternal(routePath)) {
|
93
|
85
|
return routePath
|
94
|
86
|
}
|
95
|
87
|
return path.resolve(this.basePath, routePath)
|
96
|
|
- },
|
97
|
|
- isExternalLink(routePath) {
|
98
|
|
- return isExternal(routePath)
|
99
|
88
|
}
|
100
|
89
|
}
|
101
|
90
|
}
|