From 53250a28ddb6bd7067283fca5e3db9ae153bd457 Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Sun, 18 Feb 2024 23:23:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20:bug:=20=E5=B8=83=E5=B1=80=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/components/AppMain/index.vue | 6 ++++ src/layout/components/Settings/index.vue | 17 ++++++----- .../Sidebar/components/SidebarLogo.vue | 6 ++++ src/layout/components/Sidebar/index.vue | 5 ++-- src/layout/index.vue | 28 +++++++++++++------ 5 files changed, 45 insertions(+), 17 deletions(-) diff --git a/src/layout/components/AppMain/index.vue b/src/layout/components/AppMain/index.vue index da80b7a9..ca1ef366 100644 --- a/src/layout/components/AppMain/index.vue +++ b/src/layout/components/AppMain/index.vue @@ -70,4 +70,10 @@ const cachedViews = computed(() => tagsViewStore.cachedViews); // 缓存页面 } } } + +.layout-top { + .fixed-header + .app-main { + padding-top: $tags-view-height; + } +} diff --git a/src/layout/components/Settings/index.vue b/src/layout/components/Settings/index.vue index f697056c..b3badee9 100644 --- a/src/layout/components/Settings/index.vue +++ b/src/layout/components/Settings/index.vue @@ -91,9 +91,9 @@ import { Sunny, Moon } from "@element-plus/icons-vue"; const route = useRoute(); +const appStore = useAppStore(); const settingsStore = useSettingsStore(); const permissionStore = usePermissionStore(); -const appStore = useAppStore(); function findOutermostParent(tree: any[], findName: string) { let parentMap: any = {}; @@ -122,12 +122,6 @@ function findOutermostParent(tree: any[], findName: string) { return null; } -const againActiveTop = (newVal: string) => { - const parent = findOutermostParent(permissionStore.routes, newVal); - if (appStore.activeTopMenu !== parent.path) { - appStore.activeTopMenu(parent.path); - } -}; /** * 切换布局 @@ -136,6 +130,15 @@ function changeLayout(layout: string) { settingsStore.changeSetting({ key: "layout", value: layout }); if (layout === "mix") { route.name && againActiveTop(route.name as string); + } else if (layout === "top") { + appStore.openSideBar(); + } +} + +function againActiveTop(newVal: string) { + const parent = findOutermostParent(permissionStore.routes, newVal); + if (appStore.activeTopMenu !== parent.path) { + appStore.activeTopMenu(parent.path); } } diff --git a/src/layout/components/Sidebar/components/SidebarLogo.vue b/src/layout/components/Sidebar/components/SidebarLogo.vue index d62b4da9..49328f11 100644 --- a/src/layout/components/Sidebar/components/SidebarLogo.vue +++ b/src/layout/components/Sidebar/components/SidebarLogo.vue @@ -53,5 +53,11 @@ const logo = ref(new URL(`../../../../assets/logo.png`, import.meta.url).href); .logo-container { width: $sidebar-width; } + + &.hideSidebar { + .logo-container { + width: $sidebar-width-collapsed; + } + } } diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue index acebe79a..a39a849d 100644 --- a/src/layout/components/Sidebar/index.vue +++ b/src/layout/components/Sidebar/index.vue @@ -20,9 +20,10 @@ diff --git a/src/layout/index.vue b/src/layout/index.vue index 732151e6..5991f7bf 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -48,13 +48,10 @@