From e3e7efedcf7a7ddf69b4fbd4eaee09a2404bb1f3 Mon Sep 17 00:00:00 2001 From: Frankie Huang Date: Wed, 7 May 2025 00:47:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AE=B0=E4=BD=8F=E5=B7=A6=E4=BE=A7?= =?UTF-8?q?=E6=A0=8F=E5=AE=BD=E5=BA=A6,=E4=B8=8B=E6=AC=A1=E6=89=93?= =?UTF-8?q?=E5=BC=80=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/App.vue b/src/App.vue index f2c9f5e..07633a7 100644 --- a/src/App.vue +++ b/src/App.vue @@ -39,16 +39,19 @@ async function greet() { // 使用 Split 组件动态控制页面左右布局 const defaultSplit = 0.15; // 默认左侧边栏和右侧区域的比例为 1.5:8.5 -const split = ref(defaultSplit); +const initSplit = localStorage.getItem('splitValueOfFolderTree'); +const split = initSplit === null ? ref(defaultSplit) : ref(Number(initSplit)); const splitTrigger = useTemplateRef('splitTrigger'); const splitRight = useTemplateRef('splitRight'); const splitRightWidth = ref(0); const hiddenSplitLeft = ref(''); -const leftSidebarState = ref('open'); +const leftSidebarState = split.value > 0 ? ref('open') : ref('close'); watch(split, (newSplit) => { + localStorage.setItem('splitValueOfFolderTree', newSplit); splitRightWidth.value = splitRight.value.offsetWidth; // 当 split 小于某个值时,隐藏左边布局 if (newSplit < 0.05) { + split.value = 0; leftSidebarState.value = 'close'; if (hiddenSplitLeft.value == '') { hiddenSplitLeft.value = 'hidden';