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 { isExternal } from "@/utils/validate"
|
||||||
import path from "path-browserify"
|
import path from "path-browserify"
|
||||||
import { computed } from "vue"
|
import { computed } from "vue"
|
||||||
import SidebarItemLink from "./SidebarItemLink.vue"
|
import Link from "./Link.vue"
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
item: RouteRecordRaw
|
item: RouteRecordRaw
|
||||||
@ -51,7 +51,7 @@ function resolvePath(routePath: string) {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<template v-if="!alwaysShowRootMenu && theOnlyOneChild && !theOnlyOneChild.children">
|
<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)">
|
<el-menu-item :index="resolvePath(theOnlyOneChild.path)">
|
||||||
<SvgIcon v-if="theOnlyOneChild.meta.svgIcon" :name="theOnlyOneChild.meta.svgIcon" />
|
<SvgIcon v-if="theOnlyOneChild.meta.svgIcon" :name="theOnlyOneChild.meta.svgIcon" />
|
||||||
<component v-else-if="theOnlyOneChild.meta.elIcon" :is="theOnlyOneChild.meta.elIcon" class="el-icon" />
|
<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>
|
<span class="title">{{ theOnlyOneChild.meta.title }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</SidebarItemLink>
|
</Link>
|
||||||
</template>
|
</template>
|
||||||
<el-sub-menu v-else :index="resolvePath(props.item.path)" teleported>
|
<el-sub-menu v-else :index="resolvePath(props.item.path)" teleported>
|
||||||
<template #title>
|
<template #title>
|
||||||
@ -68,7 +68,7 @@ function resolvePath(routePath: string) {
|
|||||||
<span v-if="props.item.meta?.title" class="title">{{ props.item.meta.title }}</span>
|
<span v-if="props.item.meta?.title" class="title">{{ props.item.meta.title }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="props.item.children">
|
<template v-if="props.item.children">
|
||||||
<SidebarItem
|
<Item
|
||||||
v-for="child in showingChildren"
|
v-for="child in showingChildren"
|
||||||
:key="child.path"
|
:key="child.path"
|
||||||
:item="child"
|
:item="child"
|
@ -8,7 +8,7 @@ import { getCssVar } from "@/utils/css"
|
|||||||
import { computed } from "vue"
|
import { computed } from "vue"
|
||||||
import { useRoute } from "vue-router"
|
import { useRoute } from "vue-router"
|
||||||
import { Logo } from "../index"
|
import { Logo } from "../index"
|
||||||
import SidebarItem from "./SidebarItem.vue"
|
import Item from "./Item.vue"
|
||||||
|
|
||||||
const v3SidebarMenuBgColor = getCssVar("--v3-sidebar-menu-bg-color")
|
const v3SidebarMenuBgColor = getCssVar("--v3-sidebar-menu-bg-color")
|
||||||
const v3SidebarMenuTextColor = getCssVar("--v3-sidebar-menu-text-color")
|
const v3SidebarMenuTextColor = getCssVar("--v3-sidebar-menu-text-color")
|
||||||
@ -46,7 +46,7 @@ const tipLineWidth = computed(() => !isTop.value ? "2px" : "0px")
|
|||||||
:collapse-transition="false"
|
:collapse-transition="false"
|
||||||
:mode="isTop && !isMobile ? 'horizontal' : 'vertical'"
|
:mode="isTop && !isMobile ? 'horizontal' : 'vertical'"
|
||||||
>
|
>
|
||||||
<SidebarItem
|
<Item
|
||||||
v-for="noHiddenRoute in noHiddenRoutes"
|
v-for="noHiddenRoute in noHiddenRoutes"
|
||||||
:key="noHiddenRoute.path"
|
:key="noHiddenRoute.path"
|
||||||
:item="noHiddenRoute"
|
:item="noHiddenRoute"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user