#app { // 文本颜色调整为偏黑色系(直接写死值,确保清晰) --text-primary: #1a1a1a; --text-regular: #333333; --text-secondary: #555555; --text-placeholder: #777777; --background-color: #fff; .main-container { height: 100%; transition: margin-left .28s, box-shadow .3s ease; margin-left: $base-sidebar-width; position: relative; // background: #1E2227; // 金属浅色渐变 } .sidebarHide { margin-left: 0 !important; } .sidebar-container { -webkit-transition: width .28s, background .3s ease; transition: width 0.28s, background .3s ease; width: $base-sidebar-width !important; background: var(--background-color); // 金属深色渐变 border-right: 1px solid #8d939b; height: 100%; position: fixed; font-size: 0px; top: 0; bottom: 0; left: 0; z-index: 1001; overflow: hidden; box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.15); // reset element-ui css .horizontal-collapse-transition { transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out; } .scrollbar-wrapper { overflow-x: hidden !important; } .el-scrollbar__bar.is-vertical { right: 0px; background: #2Bf; width: 0; } .el-scrollbar__thumb { background: var(--background-color); border-radius: 3px; } .el-scrollbar { height: 100%; } &.has-logo { .el-scrollbar { height: calc(100% - 50px); } } .is-horizontal { display: none; } a { display: inline-block; width: 100%; overflow: hidden; color: var(--text-regular); // 链接文本偏黑 text-decoration: none; } .svg-icon { margin-right: 16px; color: var(--text-secondary); // 图标颜色稍浅 } .el-menu { border: none; height: 100%; width: 100% !important; background: transparent; } .el-menu-item, .el-submenu__title { // 明确默认状态样式(关键修复) background: transparent !important; box-shadow: none !important; overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important; color: var(--text-regular); // 菜单项文本偏黑 border-radius: 4px; margin: 0; transition: all 0.2s ease; } // menu hover - 仅在hover时生效 .submenu-title-noDropdown, .el-submenu__title { &:hover { background: rgba(255, 255, 255, 0.1) !important; color: var(--text-primary) !important; // hover时文本更深 box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.1), inset -1px -1px 2px rgba(255, 255, 255, 0.05); } } // & .nest-menu .el-submenu>.el-submenu__title, & .el-submenu .el-menu-item { // 子菜单默认样式 background: transparent !important; box-shadow: none !important; min-width: $base-sidebar-width !important; margin: 0 4px; &:hover { background: rgba(255, 255, 255, 0.1) !important; color: var(--text-primary) !important; } } // & .theme-dark .nest-menu .el-submenu>.el-submenu__title, & .theme-dark .el-submenu .el-menu-item { background: transparent !important; color: var(--text-regular); &:hover { background: rgba(255, 255, 255, 0.1) !important; color: var(--text-primary) !important; } &.is-active { background: rgba(95, 123, 160, 0.28) !important; // 激活背景 color: #000 !important; // 激活文字白色 font-weight: 600; border-left: 3px solid #5F7BA0; // 左边高亮条 } } } .el-menu-item.is-active.submenu-title-noDropdown { background: #657b96; // 激活背景 color: #fff; // 激活文字白色 font-weight: 600; border-left: 3px solid #657b96; // 左边高亮条 } .hideSidebar { .sidebar-container { width: 54px !important; } .main-container { margin-left: 54px; } .submenu-title-noDropdown { padding: 0 !important; position: relative; .el-tooltip { padding: 0 !important; .svg-icon { margin-left: 20px; } } } .el-submenu { overflow: hidden; &>.el-submenu__title { padding: 0 !important; .svg-icon { margin-left: 20px; } } } .el-menu--collapse { .el-submenu { &>.el-submenu__title { &>span { height: 0; width: 0; overflow: hidden; visibility: hidden; display: inline-block; } } } } } .el-menu--collapse .el-menu .el-submenu { min-width: $base-sidebar-width !important; } .el-submenu .el-menu { padding-left: 10px; } // mobile responsive .mobile { .main-container { margin-left: 0px; } .sidebar-container { transition: transform .28s, box-shadow .3s ease; width: $base-sidebar-width !important; box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.15); } &.hideSidebar { .sidebar-container { pointer-events: none; transition-duration: 0.3s; transform: translate3d(-$base-sidebar-width, 0, 0); } } } .withoutAnimation { .main-container, .sidebar-container { transition: none; } } } // 收起状态下的菜单 .el-menu--vertical { &>.el-menu { .svg-icon { margin-right: 16px; color: var(--text-secondary); } } .el-menu-item .nest-menu { // 默认样式重置 background: transparent !important; box-shadow: none !important; &:hover { background: rgba(255, 255, 255, 0.1) !important; color: var(--text-primary) !important; box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.1), inset -1px -1px 2px rgba(255, 255, 255, 0.05); } ::v-deep &.is-active { background: rgba(95, 123, 160, 0.28) !important; // 工业蓝背景 color: #ffffff !important; // 激活文字白色 font-weight: 600; border-left: 3px solid #5F7BA0; box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.15), inset -1px -1px 2px rgba(255, 255, 255, 0.08); } ::v-deep .el-menu-item.is-active span, ::v-deep .el-submenu__title.is-active span { color: #ffffff !important; // 激活文字白色 } } // the scroll bar appears when the subMenu is too long >.el-menu--popup { max-height: 100vh; overflow-y: auto; background: linear-gradient(145deg, #b0b5bb, #999ea6); border: 1px solid #8d939b; box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.15); &::-webkit-scrollbar-track-piece { background: rgba(0, 0, 0, 0.05); } &::-webkit-scrollbar { width: 6px; } &::-webkit-scrollbar-thumb { background: #8d939b; border-radius: 3px; } } } #app .sidebar-container .nest-menu .el-submenu .el-submenu__title { margin: 0 4px; }