mirror of
https://github.com/un-pany/v3-admin-vite.git
synced 2025-04-20 10:59:21 +08:00
perf: 简化 Sidebar 子组件名称
This commit is contained in:
parent
9363308494
commit
f197777060
@ -3,7 +3,7 @@ import type { RouteRecordRaw } from "vue-router"
|
||||
import { isExternal } from "@/utils/validate"
|
||||
import path from "path-browserify"
|
||||
import { computed } from "vue"
|
||||
import SidebarItemLink from "./SidebarItemLink.vue"
|
||||
import Link from "./Link.vue"
|
||||
|
||||
interface Props {
|
||||
item: RouteRecordRaw
|
||||
@ -51,7 +51,7 @@ function resolvePath(routePath: string) {
|
||||
|
||||
<template>
|
||||
<template v-if="!alwaysShowRootMenu && theOnlyOneChild && !theOnlyOneChild.children">
|
||||
<SidebarItemLink v-if="theOnlyOneChild.meta" :to="resolvePath(theOnlyOneChild.path)">
|
||||
<Link v-if="theOnlyOneChild.meta" :to="resolvePath(theOnlyOneChild.path)">
|
||||
<el-menu-item :index="resolvePath(theOnlyOneChild.path)">
|
||||
<SvgIcon v-if="theOnlyOneChild.meta.svgIcon" :name="theOnlyOneChild.meta.svgIcon" />
|
||||
<component v-else-if="theOnlyOneChild.meta.elIcon" :is="theOnlyOneChild.meta.elIcon" class="el-icon" />
|
||||
@ -59,7 +59,7 @@ function resolvePath(routePath: string) {
|
||||
<span class="title">{{ theOnlyOneChild.meta.title }}</span>
|
||||
</template>
|
||||
</el-menu-item>
|
||||
</SidebarItemLink>
|
||||
</Link>
|
||||
</template>
|
||||
<el-sub-menu v-else :index="resolvePath(props.item.path)" teleported>
|
||||
<template #title>
|
||||
@ -68,7 +68,7 @@ function resolvePath(routePath: string) {
|
||||
<span v-if="props.item.meta?.title" class="title">{{ props.item.meta.title }}</span>
|
||||
</template>
|
||||
<template v-if="props.item.children">
|
||||
<SidebarItem
|
||||
<Item
|
||||
v-for="child in showingChildren"
|
||||
:key="child.path"
|
||||
:item="child"
|
@ -8,7 +8,7 @@ import { getCssVar } from "@/utils/css"
|
||||
import { computed } from "vue"
|
||||
import { useRoute } from "vue-router"
|
||||
import { Logo } from "../index"
|
||||
import SidebarItem from "./SidebarItem.vue"
|
||||
import Item from "./Item.vue"
|
||||
|
||||
const v3SidebarMenuBgColor = getCssVar("--v3-sidebar-menu-bg-color")
|
||||
const v3SidebarMenuTextColor = getCssVar("--v3-sidebar-menu-text-color")
|
||||
@ -46,7 +46,7 @@ const tipLineWidth = computed(() => !isTop.value ? "2px" : "0px")
|
||||
:collapse-transition="false"
|
||||
:mode="isTop && !isMobile ? 'horizontal' : 'vertical'"
|
||||
>
|
||||
<SidebarItem
|
||||
<Item
|
||||
v-for="noHiddenRoute in noHiddenRoutes"
|
||||
:key="noHiddenRoute.path"
|
||||
:item="noHiddenRoute"
|
||||
|
Loading…
x
Reference in New Issue
Block a user