From a1845585a68e238710b4566934e148fab938067b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Tue, 15 Aug 2023 18:18:40 +0800 Subject: [PATCH] =?UTF-8?q?:art:=E4=BE=A7=E8=BE=B9=E6=A0=8F=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/components/Sidebar/SidebarItem.vue | 13 +++++++++++++ src/layout/components/Sidebar/index.vue | 7 ++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/layout/components/Sidebar/SidebarItem.vue b/src/layout/components/Sidebar/SidebarItem.vue index d0a08c4..61746a2 100644 --- a/src/layout/components/Sidebar/SidebarItem.vue +++ b/src/layout/components/Sidebar/SidebarItem.vue @@ -5,6 +5,7 @@ + {{ hasTitle2(onlyOneChild.meta.title) }} @@ -45,6 +46,10 @@ const props = defineProps({ basePath: { type: String, default: '' + }, + isCollapse: { + type: Boolean, + default: false } }) @@ -102,4 +107,12 @@ function hasTitle(title) { return '' } } + +function hasTitle2(title) { + if (title.length >= 1) { + return title.charAt(0) + '...' + } else { + return '' + } +} diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue index 7683035..fe86291 100644 --- a/src/layout/components/Sidebar/index.vue +++ b/src/layout/components/Sidebar/index.vue @@ -11,7 +11,12 @@ :collapse-transition="false" background-color="transparent" mode="vertical"> - +