From 36fc9186e39f2fd317603728b4ad3482a91b079b Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期三, 19 三月 2025 14:22:48 +0800 Subject: [PATCH] 合并装备代码 --- src/layout/components/Sidebar/SidebarItem.vue | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/layout/components/Sidebar/SidebarItem.vue b/src/layout/components/Sidebar/SidebarItem.vue index 3b68ff2..1a7b1bf 100644 --- a/src/layout/components/Sidebar/SidebarItem.vue +++ b/src/layout/components/Sidebar/SidebarItem.vue @@ -1,10 +1,9 @@ <template> <div v-if="!item.hidden"> - <template - v-if="hasOneShowingChild(item.children, item) && (!onlyOneChild.children || onlyOneChild.noShowingChildren) && !item.alwaysShow"> + <template v-if="hasOneShowingChild(item.children,item) && (!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 }"> - <item :icon="onlyOneChild.meta.icon || (item.meta && item.meta.icon)" :title="onlyOneChild.meta.title" /> + <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> </app-link> </template> @@ -13,8 +12,14 @@ <template slot="title"> <item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" /> </template> - <sidebar-item v-for="(child, index) in item.children" :key="child.path + index" :is-nest="true" :item="child" - :base-path="resolvePath(child.path)" class="nest-menu" /> + <sidebar-item + v-for="(child, index) in item.children" + :key="child.path + index" + :is-nest="true" + :item="child" + :base-path="resolvePath(child.path)" + class="nest-menu" + /> </el-submenu> </div> </template> @@ -70,7 +75,7 @@ // Show parent if there are no child router to display if (showingChildren.length === 0) { - this.onlyOneChild = { ...parent, path: '', noShowingChildren: true } + this.onlyOneChild = { ... parent, path: '', noShowingChildren: true } return true } @@ -96,4 +101,4 @@ ::v-deep .el-submenu__title i { color: #ffffff !important; } -</style> \ No newline at end of file +</style> -- Gitblit v1.9.3