From 0abde46ef4ebebba63a15424d5bb8f981ce7eb78 Mon Sep 17 00:00:00 2001 From: Soybean Date: Fri, 26 May 2023 13:08:35 +0800 Subject: [PATCH] =?UTF-8?q?fix(projects):=20hide=20the=20drawer=20when=20i?= =?UTF-8?q?t=20is=20initial=20mobile=20mode=20[=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E6=97=B6=E4=B8=BA=E7=A7=BB=E5=8A=A8=E7=AB=AF=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E5=88=99=E9=9A=90=E8=97=8F=E4=BE=A7=E8=BE=B9=E6=A0=8F]=20fixed?= =?UTF-8?q?=20#238?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/composables/layout.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/composables/layout.ts b/src/composables/layout.ts index 3280da2b..0db24db4 100644 --- a/src/composables/layout.ts +++ b/src/composables/layout.ts @@ -1,4 +1,4 @@ -import { computed } from 'vue'; +import { computed, watch } from 'vue'; import { breakpointsTailwind, useBreakpoints } from '@vueuse/core'; import { useAppStore, useThemeStore } from '@/store'; @@ -63,6 +63,16 @@ export function useBasicLayout() { return w; }); + watch( + isMobile, + newValue => { + if (newValue) { + app.setSiderCollapse(true); + } + }, + { immediate: true } + ); + return { mode, isMobile,