Skip to content

Commit

Permalink
feat: 左侧导航菜单 title 过长自动省略
Browse files Browse the repository at this point in the history
  • Loading branch information
pany-ang committed Nov 21, 2024
1 parent b8033dc commit 3155c08
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/layouts/components/Sidebar/SidebarItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function resolvePath(routePath: string) {
<SvgIcon v-if="theOnlyOneChild.meta.svgIcon" :name="theOnlyOneChild.meta.svgIcon" />
<component v-else-if="theOnlyOneChild.meta.elIcon" :is="theOnlyOneChild.meta.elIcon" class="el-icon" />
<template v-if="theOnlyOneChild.meta.title" #title>
{{ theOnlyOneChild.meta.title }}
<span class="title">{{ theOnlyOneChild.meta.title }}</span>
</template>
</el-menu-item>
</SidebarItemLink>
Expand All @@ -69,7 +69,7 @@ function resolvePath(routePath: string) {
<template #title>
<SvgIcon v-if="props.item.meta?.svgIcon" :name="props.item.meta.svgIcon" />
<component v-else-if="props.item.meta?.elIcon" :is="props.item.meta.elIcon" class="el-icon" />
<span v-if="props.item.meta?.title">{{ props.item.meta.title }}</span>
<span v-if="props.item.meta?.title" class="title">{{ props.item.meta.title }}</span>
</template>
<template v-if="props.item.children">
<SidebarItem
Expand All @@ -83,6 +83,8 @@ function resolvePath(routePath: string) {
</template>

<style lang="scss" scoped>
@import "@/styles/mixins.scss";
.svg-icon {
min-width: 1em;
margin-right: 12px;
Expand All @@ -94,4 +96,8 @@ function resolvePath(routePath: string) {
margin-right: 12px !important;
font-size: 18px;
}
.title {
@extend %ellipsis;
}
</style>

0 comments on commit 3155c08

Please sign in to comment.