Files
klp-oa/klp-ui/src/assets/styles/sidebar.scss

306 lines
6.9 KiB
SCSS
Raw Normal View History

#app {
2025-08-28 15:06:03 +08:00
// 文本颜色调整为偏黑色系(直接写死值,确保清晰)
--text-primary: #1a1a1a;
--text-regular: #333333;
--text-secondary: #555555;
--text-placeholder: #777777;
2025-09-24 17:23:06 +08:00
--background-color: #fff;
.main-container {
height: 100%;
2025-08-28 15:06:03 +08:00
transition: margin-left .28s, box-shadow .3s ease;
margin-left: $base-sidebar-width;
position: relative;
2025-09-24 17:23:06 +08:00
// background: #1E2227; // 金属浅色渐变
}
2022-03-19 14:05:07 +08:00
.sidebarHide {
2025-09-02 15:39:51 +08:00
margin-left: 0 !important;
2022-03-19 14:05:07 +08:00
}
.sidebar-container {
2025-08-28 15:06:03 +08:00
-webkit-transition: width .28s, background .3s ease;
transition: width 0.28s, background .3s ease;
width: $base-sidebar-width !important;
2025-09-24 17:23:06 +08:00
background: var(--background-color); // 金属深色渐变
2025-08-28 15:06:03 +08:00
border-right: 1px solid #8d939b;
height: 100%;
position: fixed;
font-size: 0px;
top: 0;
bottom: 0;
left: 0;
z-index: 1001;
overflow: hidden;
2025-08-28 15:06:03 +08:00
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;
2025-09-24 17:23:06 +08:00
background: #2Bf;
width: 0;
2025-08-28 15:06:03 +08:00
}
.el-scrollbar__thumb {
2025-09-24 17:23:06 +08:00
background: var(--background-color);
2025-08-28 15:06:03 +08:00
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;
2025-08-28 15:06:03 +08:00
color: var(--text-regular); // 链接文本偏黑
text-decoration: none;
}
.svg-icon {
margin-right: 16px;
2025-08-28 15:06:03 +08:00
color: var(--text-secondary); // 图标颜色稍浅
}
.el-menu {
border: none;
height: 100%;
width: 100% !important;
2025-08-28 15:06:03 +08:00
background: transparent;
}
2025-09-02 15:39:51 +08:00
.el-menu-item,
.el-submenu__title {
2025-08-28 15:06:03 +08:00
// 明确默认状态样式(关键修复)
background: transparent !important;
box-shadow: none !important;
overflow: hidden !important;
text-overflow: ellipsis !important;
white-space: nowrap !important;
2025-08-28 15:06:03 +08:00
color: var(--text-regular); // 菜单项文本偏黑
border-radius: 4px;
margin: 0;
2025-08-28 15:06:03 +08:00
transition: all 0.2s ease;
}
2025-08-28 15:06:03 +08:00
// menu hover - 仅在hover时生效
.submenu-title-noDropdown,
.el-submenu__title {
&:hover {
2025-08-28 15:06:03 +08:00
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),
2025-09-02 15:39:51 +08:00
inset -1px -1px 2px rgba(255, 255, 255, 0.05);
}
}
2025-08-28 15:06:03 +08:00
// & .nest-menu .el-submenu>.el-submenu__title,
& .el-submenu .el-menu-item {
2025-08-28 15:06:03 +08:00
// 子菜单默认样式
background: transparent !important;
box-shadow: none !important;
min-width: $base-sidebar-width !important;
2025-08-28 15:06:03 +08:00
margin: 0 4px;
&:hover {
2025-08-28 15:06:03 +08:00
background: rgba(255, 255, 255, 0.1) !important;
color: var(--text-primary) !important;
}
}
2025-08-28 15:06:03 +08:00
// & .theme-dark .nest-menu .el-submenu>.el-submenu__title,
& .theme-dark .el-submenu .el-menu-item {
2025-08-28 15:06:03 +08:00
background: transparent !important;
color: var(--text-regular);
&:hover {
2025-08-28 15:06:03 +08:00
background: rgba(255, 255, 255, 0.1) !important;
color: var(--text-primary) !important;
}
&.is-active {
background: rgba(95, 123, 160, 0.28) !important; // 激活背景
2025-09-24 17:23:06 +08:00
color: #000 !important; // 激活文字白色
2025-08-28 15:06:03 +08:00
font-weight: 600;
border-left: 3px solid #5F7BA0; // 左边高亮条
}
}
}
2025-09-02 15:39:51 +08:00
.el-menu-item.is-active.submenu-title-noDropdown {
2025-09-24 17:23:06 +08:00
background: #657b96; // 激活背景
color: #fff; // 激活文字白色
2025-09-02 15:39:51 +08:00
font-weight: 600;
2025-09-24 17:23:06 +08:00
border-left: 3px solid #657b96; // 左边高亮条
2025-09-02 15:39:51 +08:00
}
.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;
}
2025-09-10 16:20:04 +08:00
.el-submenu .el-menu {
2025-09-02 15:39:51 +08:00
padding-left: 10px;
}
// mobile responsive
.mobile {
.main-container {
margin-left: 0px;
}
.sidebar-container {
2025-08-28 15:06:03 +08:00
transition: transform .28s, box-shadow .3s ease;
width: $base-sidebar-width !important;
2025-08-28 15:06:03 +08:00
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 {
2025-09-02 15:39:51 +08:00
.main-container,
.sidebar-container {
transition: none;
}
}
}
2025-09-24 17:23:06 +08:00
// 收起状态下的菜单
.el-menu--vertical {
&>.el-menu {
.svg-icon {
margin-right: 16px;
2025-08-28 15:06:03 +08:00
color: var(--text-secondary);
}
}
2025-08-28 15:06:03 +08:00
.el-menu-item .nest-menu {
// 默认样式重置
background: transparent !important;
box-shadow: none !important;
&:hover {
2025-08-28 15:06:03 +08:00
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),
2025-09-02 15:39:51 +08:00
inset -1px -1px 2px rgba(255, 255, 255, 0.05);
2025-08-28 15:06:03 +08:00
}
::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),
2025-09-02 15:39:51 +08:00
inset -1px -1px 2px rgba(255, 255, 255, 0.08);
2025-08-28 15:06:03 +08:00
}
::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;
2025-08-28 15:06:03 +08:00
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 {
2025-08-28 15:06:03 +08:00
background: rgba(0, 0, 0, 0.05);
}
&::-webkit-scrollbar {
width: 6px;
}
&::-webkit-scrollbar-thumb {
2025-08-28 15:06:03 +08:00
background: #8d939b;
2025-09-02 15:39:51 +08:00
border-radius: 3px;
}
}
}
2025-08-25 11:46:03 +08:00
#app .sidebar-container .nest-menu .el-submenu .el-submenu__title {
margin: 0 4px;
2025-08-25 11:46:03 +08:00
}