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 @@