Skip to content

Commit f197777

Browse files
committed
perf: 简化 Sidebar 子组件名称
1 parent 9363308 commit f197777

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/layouts/components/Sidebar/SidebarItem.vue renamed to src/layouts/components/Sidebar/Item.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { RouteRecordRaw } from "vue-router"
33
import { isExternal } from "@/utils/validate"
44
import path from "path-browserify"
55
import { computed } from "vue"
6-
import SidebarItemLink from "./SidebarItemLink.vue"
6+
import Link from "./Link.vue"
77
88
interface Props {
99
item: RouteRecordRaw
@@ -51,15 +51,15 @@ function resolvePath(routePath: string) {
5151

5252
<template>
5353
<template v-if="!alwaysShowRootMenu && theOnlyOneChild && !theOnlyOneChild.children">
54-
<SidebarItemLink v-if="theOnlyOneChild.meta" :to="resolvePath(theOnlyOneChild.path)">
54+
<Link v-if="theOnlyOneChild.meta" :to="resolvePath(theOnlyOneChild.path)">
5555
<el-menu-item :index="resolvePath(theOnlyOneChild.path)">
5656
<SvgIcon v-if="theOnlyOneChild.meta.svgIcon" :name="theOnlyOneChild.meta.svgIcon" />
5757
<component v-else-if="theOnlyOneChild.meta.elIcon" :is="theOnlyOneChild.meta.elIcon" class="el-icon" />
5858
<template v-if="theOnlyOneChild.meta.title" #title>
5959
<span class="title">{{ theOnlyOneChild.meta.title }}</span>
6060
</template>
6161
</el-menu-item>
62-
</SidebarItemLink>
62+
</Link>
6363
</template>
6464
<el-sub-menu v-else :index="resolvePath(props.item.path)" teleported>
6565
<template #title>
@@ -68,7 +68,7 @@ function resolvePath(routePath: string) {
6868
<span v-if="props.item.meta?.title" class="title">{{ props.item.meta.title }}</span>
6969
</template>
7070
<template v-if="props.item.children">
71-
<SidebarItem
71+
<Item
7272
v-for="child in showingChildren"
7373
:key="child.path"
7474
:item="child"
File renamed without changes.

src/layouts/components/Sidebar/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { getCssVar } from "@/utils/css"
88
import { computed } from "vue"
99
import { useRoute } from "vue-router"
1010
import { Logo } from "../index"
11-
import SidebarItem from "./SidebarItem.vue"
11+
import Item from "./Item.vue"
1212
1313
const v3SidebarMenuBgColor = getCssVar("--v3-sidebar-menu-bg-color")
1414
const v3SidebarMenuTextColor = getCssVar("--v3-sidebar-menu-text-color")
@@ -46,7 +46,7 @@ const tipLineWidth = computed(() => !isTop.value ? "2px" : "0px")
4646
:collapse-transition="false"
4747
:mode="isTop && !isMobile ? 'horizontal' : 'vertical'"
4848
>
49-
<SidebarItem
49+
<Item
5050
v-for="noHiddenRoute in noHiddenRoutes"
5151
:key="noHiddenRoute.path"
5252
:item="noHiddenRoute"

0 commit comments

Comments
 (0)