From 74f2f7b72585eaf374fc5a4dc4d3696651286011 Mon Sep 17 00:00:00 2001 From: pany <939630029@qq.com> Date: Tue, 13 Jun 2023 13:00:35 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96=20?= =?UTF-8?q?layout/index?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/index.vue | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/layout/index.vue b/src/layout/index.vue index ffdece1..4dfcbe5 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -12,14 +12,15 @@ const settingsStore = useSettingsStore() /** Layout 布局响应式 */ useResize() -const classObj = computed(() => { +/** 定义计算属性 layoutClasses,用于控制布局的类名 */ +const layoutClasses = computed(() => { return { hideSidebar: !appStore.sidebar.opened, openSidebar: appStore.sidebar.opened, withoutAnimation: appStore.sidebar.withoutAnimation, mobile: appStore.device === DeviceEnum.Mobile, - showGreyMode: showGreyMode.value, - showColorWeakness: showColorWeakness.value + showGreyMode: settingsStore.showGreyMode, + showColorWeakness: settingsStore.showColorWeakness } }) @@ -32,27 +33,29 @@ const showTagsView = computed(() => { const fixedHeader = computed(() => { return settingsStore.fixedHeader }) -const showGreyMode = computed(() => { - return settingsStore.showGreyMode -}) -const showColorWeakness = computed(() => { - return settingsStore.showColorWeakness -}) + +/** 用于处理点击 mobile 端侧边栏遮罩层的事件 */ const handleClickOutside = () => { appStore.closeSidebar(false) }