fix顶部导航栏bug,新增加关闭tagsView左右两侧视图
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
<template>
|
||||
<div v-if="!item.hidden">
|
||||
|
||||
<template v-if="hasOneShowingChild(item.children,item) && (!onlyOneChild.children||onlyOneChild.noShowingChildren)&&!item.alwaysShow">
|
||||
<app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path)">
|
||||
<app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path, onlyOneChild.query)">
|
||||
<el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}">
|
||||
<item :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="onlyOneChild.meta.title" />
|
||||
</el-menu-item>
|
||||
@@ -15,7 +14,6 @@
|
||||
</template>
|
||||
<sidebar-item v-for="child in item.children" :key="child.path" :is-nest="true" :item="child" :base-path="resolvePath(child.path)" class="nest-menu" />
|
||||
</el-submenu>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -49,16 +47,17 @@ export default {
|
||||
this.onlyOneChild = null;
|
||||
return {};
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
hasOneShowingChild(children = [], parent) {
|
||||
if (!children) {
|
||||
children = [];
|
||||
}
|
||||
const showingChildren = children.filter((item) => {
|
||||
if (item.hidden) {
|
||||
return false;
|
||||
} else {
|
||||
// Temp set(will be used if only has one showing child)
|
||||
this.onlyOneChild = item;
|
||||
// console.log(JSON.stringify(item));
|
||||
return true;
|
||||
}
|
||||
});
|
||||
@@ -76,14 +75,17 @@ export default {
|
||||
|
||||
return false;
|
||||
},
|
||||
resolvePath(routePath) {
|
||||
// console.log(routePath);
|
||||
resolvePath(routePath, routeQuery) {
|
||||
if (isExternal(routePath)) {
|
||||
return routePath;
|
||||
}
|
||||
if (isExternal(this.basePath)) {
|
||||
return this.basePath;
|
||||
}
|
||||
if (routeQuery) {
|
||||
let query = JSON.parse(routeQuery);
|
||||
return { path: path.resolve(this.basePath, routePath), query: query };
|
||||
}
|
||||
return path.resolve(this.basePath, routePath);
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user