From 3c4f8f90eb006e2012744566a895d80baf20b623 Mon Sep 17 00:00:00 2001 From: pany <939630029@qq.com> Date: Tue, 30 Apr 2024 21:31:25 +0800 Subject: [PATCH 1/3] =?UTF-8?q?wip:=20=E4=B8=BB=E9=A2=98=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E5=85=A8=E9=9D=A2=E9=87=87=E7=94=A8=20css=20var?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/LeftMode.vue | 4 ++ .../components/NavigationBar/index.vue | 10 ----- src/layouts/components/Sidebar/index.vue | 38 +++++++++++-------- src/styles/element-plus.css | 2 +- src/styles/index.scss | 4 +- src/styles/variables.css | 18 ++++++++- src/styles/vxe-table.css | 4 +- 7 files changed, 49 insertions(+), 31 deletions(-) diff --git a/src/layouts/LeftMode.vue b/src/layouts/LeftMode.vue index 5b6d0545..588bab4b 100644 --- a/src/layouts/LeftMode.vue +++ b/src/layouts/LeftMode.vue @@ -67,6 +67,10 @@ $transition-time: 0.35s; .sidebar-container { background-color: var(--v3-sidebar-menu-bg-color); + --el-menu-bg-color: var(--v3-sidebar-menu-bg-color); + --el-menu-hover-bg-color: var(--v3-sidebar-menu-hover-bg-color); + --el-menu-text-color: var(--v3-sidebar-menu-text-color); + --el-menu-active-color: var(--v3-sidebar-menu-active-text-color); transition: width $transition-time; width: var(--v3-sidebar-width) !important; height: 100%; diff --git a/src/layouts/components/NavigationBar/index.vue b/src/layouts/components/NavigationBar/index.vue index e8413e93..5bec4697 100644 --- a/src/layouts/components/NavigationBar/index.vue +++ b/src/layouts/components/NavigationBar/index.vue @@ -98,16 +98,6 @@ const logout = () => { flex: 1; // 设置 min-width 是为了让 Sidebar 里的 el-menu 宽度自适应 min-width: 0px; - :deep(.el-menu) { - background-color: transparent; - } - :deep(.el-sub-menu) { - &.is-active { - .el-sub-menu__title { - color: var(--el-color-primary) !important; - } - } - } } .right-menu { margin-right: 10px; diff --git a/src/layouts/components/Sidebar/index.vue b/src/layouts/components/Sidebar/index.vue index 29f6a567..5c321a34 100644 --- a/src/layouts/components/Sidebar/index.vue +++ b/src/layouts/components/Sidebar/index.vue @@ -8,11 +8,11 @@ import SidebarItem from "./SidebarItem.vue" import Logo from "../Logo/index.vue" import { useDevice } from "@/hooks/useDevice" import { useLayoutMode } from "@/hooks/useLayoutMode" -import { getCssVariableValue } from "@/utils" +// import { getCssVariableValue } from "@/utils" -const v3SidebarMenuBgColor = getCssVariableValue("--v3-sidebar-menu-bg-color") -const v3SidebarMenuTextColor = getCssVariableValue("--v3-sidebar-menu-text-color") -const v3SidebarMenuActiveTextColor = getCssVariableValue("--v3-sidebar-menu-active-text-color") +// const v3SidebarMenuBgColor = getCssVariableValue("--v3-sidebar-menu-bg-color") +// const v3SidebarMenuTextColor = getCssVariableValue("--v3-sidebar-menu-text-color") +// const v3SidebarMenuActiveTextColor = getCssVariableValue("--v3-sidebar-menu-active-text-color") const { isMobile } = useDevice() const { isLeft, isTop } = useLayoutMode() @@ -31,15 +31,15 @@ const activeMenu = computed(() => { const noHiddenRoutes = computed(() => permissionStore.routes.filter((item) => !item.meta?.hidden)) const isCollapse = computed(() => !appStore.sidebar.opened) const isLogo = computed(() => isLeft.value && settingsStore.showLogo) -const backgroundColor = computed(() => (isLeft.value ? v3SidebarMenuBgColor : undefined)) -const textColor = computed(() => (isLeft.value ? v3SidebarMenuTextColor : undefined)) -const activeTextColor = computed(() => (isLeft.value ? v3SidebarMenuActiveTextColor : undefined)) +// const backgroundColor = computed(() => (isLeft.value ? v3SidebarMenuBgColor : undefined)) +// const textColor = computed(() => (isLeft.value ? v3SidebarMenuTextColor : undefined)) +// const activeTextColor = computed(() => (isLeft.value ? v3SidebarMenuActiveTextColor : undefined)) const sidebarMenuItemHeight = computed(() => { return !isTop.value ? "var(--v3-sidebar-menu-item-height)" : "var(--v3-navigationbar-height)" }) -const sidebarMenuHoverBgColor = computed(() => { - return !isTop.value ? "var(--v3-sidebar-menu-hover-bg-color)" : "transparent" -}) +// const sidebarMenuHoverBgColor = computed(() => { +// return !isTop.value ? "var(--v3-sidebar-menu-hover-bg-color)" : "transparent" +// }) const tipLineWidth = computed(() => { return !isTop.value ? "2px" : "0px" }) @@ -56,12 +56,10 @@ const hiddenScrollbarVerticalBar = computed(() => { @@ -69,6 +67,15 @@ const hiddenScrollbarVerticalBar = computed(() => { + +