From 6a7ec8116847cdec2b75295708b773b1a9c57bcf Mon Sep 17 00:00:00 2001 From: 棉花 <12559203+radish-hi_0@user.noreply.gitee.com> Date: 星期五, 08 十二月 2023 17:55:11 +0800 Subject: [PATCH] fix: 删除重复环境变量ElUploadInstance --- src/layout/components/Sidebar/SidebarItem.vue | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/layout/components/Sidebar/SidebarItem.vue b/src/layout/components/Sidebar/SidebarItem.vue index f803f13..4459cdf 100644 --- a/src/layout/components/Sidebar/SidebarItem.vue +++ b/src/layout/components/Sidebar/SidebarItem.vue @@ -1,6 +1,6 @@ <template> <div v-if="!item.hidden"> - <template v-if="hasOneShowingChild(item.children, item) && (!onlyOneChild.children || onlyOneChild.noShowingChildren) && !item.alwaysShow"> + <template v-if="hasOneShowingChild(item, item.children) && (!onlyOneChild.children || onlyOneChild.noShowingChildren) && !item.alwaysShow"> <app-link v-if="onlyOneChild.meta" :to="resolvePath(onlyOneChild.path, onlyOneChild.query)"> <el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{ 'submenu-title-noDropdown': !isNest }"> <svg-icon :icon-class="onlyOneChild.meta.icon || (item.meta && item.meta.icon)" /> @@ -18,10 +18,10 @@ </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 as RouteOption" + :item="child" :base-path="resolvePath(child.path)" class="nest-menu" /> @@ -34,7 +34,6 @@ import AppLink from './Link.vue' import { getNormalPath } from '@/utils/ruoyi' import { RouteOption } from "vue-router"; -import { PropType } from "vue"; const props = defineProps({ // route object @@ -54,7 +53,7 @@ const onlyOneChild = ref<any>({}); -const hasOneShowingChild = (children:RouteOption[] = [], parent: RouteOption) => { +const hasOneShowingChild = (parent: RouteOption, children?:RouteOption[]) => { if (!children) { children = []; } @@ -76,9 +75,13 @@ // Show parent if there are no child router to display if (showingChildren.length === 0) { onlyOneChild.value = { ...parent, path: '', noShowingChildren: true } + if (parent.name === '2222') { + console.log(onlyOneChild.value) + } return true } + return false }; -- Gitblit v1.9.3