File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 22 <div class =" menu-wrapper" >
33 <template v-for =" item in routes " v-if =" ! item .hidden && item .children " >
44
5- <router-link v-if =" item.children.length===1 && !item.children[0].children&& !item.alwaysShow" :to =" item.path+'/'+item.children[0].path" :key =" item.children[0].name" >
5+ <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" >
66 <el-menu-item :index =" item.path+'/'+item.children[0].path" :class =" {'submenu-title-noDropdown':!isNest}" >
77 <svg-icon v-if =" item.children[0].meta&&item.children[0].meta.icon" :icon-class =" item.children[0].meta.icon" ></svg-icon >
88 <span v-if =" item.children[0].meta&&item.children[0].meta.title" >{{generateTitle(item.children[0].meta.title)}}</span >
@@ -46,6 +46,15 @@ export default {
4646 }
4747 },
4848 methods: {
49+ hasOneShowingChildren (children ) {
50+ const showingChildren = children .filter (item => {
51+ return ! item .hidden
52+ })
53+ if (showingChildren .length === 1 ) {
54+ return true
55+ }
56+ return false
57+ },
4958 generateTitle
5059 }
5160}
You can’t perform that action at this time.
0 commit comments