| | |
| | | <template>
|
| | | <div v-if="!item.hidden" class="menu-wrapper">
|
| | | <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>
|
| | |
| | | <item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" />
|
| | | </template>
|
| | | <sidebar-item
|
| | | v-for="child in item.children"
|
| | | :key="child.path"
|
| | | v-for="(child, index) in item.children"
|
| | | :key="child.path + index"
|
| | | :is-nest="true"
|
| | | :item="child"
|
| | | :base-path="resolvePath(child.path)"
|
| | |
| | | },
|
| | | methods: {
|
| | | hasOneShowingChild(children = [], parent) {
|
| | | if (!children) {
|
| | | children = [];
|
| | | }
|
| | | const showingChildren = children.filter(item => {
|
| | | if (item.hidden) {
|
| | | return false
|
| | |
| | |
|
| | | return false
|
| | | },
|
| | | resolvePath(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)
|
| | | }
|
| | | }
|