Skip to content

Commit 3155c08

Browse files
committed
feat: 左侧导航菜单 title 过长自动省略
1 parent b8033dc commit 3155c08

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/layouts/components/Sidebar/SidebarItem.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function resolvePath(routePath: string) {
6060
<SvgIcon v-if="theOnlyOneChild.meta.svgIcon" :name="theOnlyOneChild.meta.svgIcon" />
6161
<component v-else-if="theOnlyOneChild.meta.elIcon" :is="theOnlyOneChild.meta.elIcon" class="el-icon" />
6262
<template v-if="theOnlyOneChild.meta.title" #title>
63-
{{ theOnlyOneChild.meta.title }}
63+
<span class="title">{{ theOnlyOneChild.meta.title }}</span>
6464
</template>
6565
</el-menu-item>
6666
</SidebarItemLink>
@@ -69,7 +69,7 @@ function resolvePath(routePath: string) {
6969
<template #title>
7070
<SvgIcon v-if="props.item.meta?.svgIcon" :name="props.item.meta.svgIcon" />
7171
<component v-else-if="props.item.meta?.elIcon" :is="props.item.meta.elIcon" class="el-icon" />
72-
<span v-if="props.item.meta?.title">{{ props.item.meta.title }}</span>
72+
<span v-if="props.item.meta?.title" class="title">{{ props.item.meta.title }}</span>
7373
</template>
7474
<template v-if="props.item.children">
7575
<SidebarItem
@@ -83,6 +83,8 @@ function resolvePath(routePath: string) {
8383
</template>
8484

8585
<style lang="scss" scoped>
86+
@import "@/styles/mixins.scss";
87+
8688
.svg-icon {
8789
min-width: 1em;
8890
margin-right: 12px;
@@ -94,4 +96,8 @@ function resolvePath(routePath: string) {
9496
margin-right: 12px !important;
9597
font-size: 18px;
9698
}
99+
100+
.title {
101+
@extend %ellipsis;
102+
}
97103
</style>

0 commit comments

Comments
 (0)