From 1217f1abdc054413c743a5aad2e3f7db5cf9e4f5 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: Sat, 6 May 2023 19:40:19 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E8=8F=9C=E5=8D=95=E4=B9=8B=E5=90=8E=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E4=B8=8D=E4=BC=9A=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/components/Sidebar/index.vue | 7 +++++- src/layout/index.vue | 30 +++++++++++++++++-------- src/store/modules/app.js | 12 +++++----- 3 files changed, 32 insertions(+), 17 deletions(-) diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue index 399637d..7683035 100644 --- a/src/layout/components/Sidebar/index.vue +++ b/src/layout/components/Sidebar/index.vue @@ -34,7 +34,7 @@ const showLogo = computed(() => settingsStore.sidebarLogo) const sideTheme = computed(() => settingsStore.sideTheme) const theme = computed(() => settingsStore.theme) const isCollapse = computed(() => !appStore.sidebar.opened) - +const device = computed(() => appStore.device) const activeMenu = computed(() => { const { meta, path } = route // if set path, the sidebar will highlight the path you set @@ -43,4 +43,9 @@ const activeMenu = computed(() => { } return path }) +watch(route, (val) => { + if (device.value === 'mobile') { + appStore.closeSideBar() + } +}) diff --git a/src/layout/index.vue b/src/layout/index.vue index d501bc8..3ea0a25 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -1,7 +1,14 @@