@import "../layout/theme/default-vars.scss"; @mixin merge-style( // vertical模式下主体内容距离网页文档左侧的距离 $sideBarWidth ) { $menuActiveText: #7a80b4; @media screen and (min-width: 150px) and (max-width: 420px) { .app-main-nofixed-header { overflow-y: hidden; } } @media screen and (min-width: 420px) { .app-main-nofixed-header { overflow: hidden; } } .el-menu-item, .el-sub-menu__title { &:hover { color: $menuTitleHover !important; } } .el-sub-menu__icon-arrow { position: absolute; } .main-container { height: 100vh; min-height: 100%; transition: margin-left 0.28s; margin-left: $sideBarWidth; position: relative; @media screen and (min-width: 150px) and (max-width: 420px) { .el-scrollbar__view { overflow-y: hidden; } } @media screen and (min-width: 420px) { .el-scrollbar__view { overflow: hidden; } } } .fixed-header { position: fixed; top: 0; right: 0; z-index: 1000; width: calc(100% - 210px); transition: width 0.28s; } .main-hidden { margin-left: 0 !important; .fixed-header { width: 100% !important; + .app-main { padding-top: 37px; } } } .el-popper.is-light { border: none !important; } .sidebar-container { transition: width 0.28s; width: $sideBarWidth !important; background: $menuBg; height: 100%; position: fixed; font-size: 0; top: 0; bottom: 0; left: 0; z-index: 1001; overflow: hidden; box-shadow: 0 0 1px #888; .scrollbar-wrapper { overflow-x: hidden !important; } .horizontal-collapse-transition { transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out; } .el-scrollbar__bar.is-vertical { right: 0; } .el-scrollbar { height: 100%; } &.has-logo { .el-scrollbar { height: calc(100% - 50px); } } .is-horizontal { display: none; } a { display: inline-block; display: flex; padding-left: 10px; flex-wrap: wrap; width: 100%; } .el-menu { border: none; height: 100%; background-color: transparent !important; } .el-menu-item, .el-sub-menu__title { color: $menuText; } // menu hover .submenu-title-noDropdown, .el-sub-menu__title { &:hover { background-color: $menuHover !important; } } .is-active > .el-sub-menu__title, .is-active.submenu-title-noDropdown { color: $subMenuActiveText !important; i { color: $subMenuActiveText !important; } } .is-active { transition: color 0.3s; color: $subMenuActiveText !important; } .el-menu .el-menu--inline .el-sub-menu__title, & .el-sub-menu .el-menu-item { font-size: 12px; min-width: $sideBarWidth !important; background-color: $subMenuBg !important; &:hover { background-color: $subMenuHover !important; } } } .horizontal-header { display: flex; justify-content: space-around; background: $menuBg; width: 100%; height: 62px; align-items: center; .horizontal-header-left { display: flex; height: 100%; width: auto; min-width: 200px; align-items: center; padding-left: 10px; cursor: pointer; transition: all 0.2s ease; &:hover { background: $menuHover; } i { font-size: 30px; color: #1890ff; margin-right: 4px; } h4 { font-size: 16px; font-weight: 700; color: $navTextColor; transition: all 0.5s; } } .horizontal-header-menu { height: 100%; min-width: 0; flex: 1; align-items: center; } .horizontal-header-right { display: flex; min-width: 280px; align-items: center; color: $navTextColor; justify-content: flex-end; .screen-full { cursor: pointer; &:hover { background: $menuHover; } } .globalization { height: 62px; width: 40px; padding: 11px; cursor: pointer; color: $navTextColor; &:hover { background: $menuHover; } } .el-dropdown-link { width: 100px; height: 62px; padding: 10px; display: flex; align-items: center; justify-content: space-around; cursor: pointer; color: $navTextColor; &:hover { background: $menuHover; } p { font-size: 14px; } img { width: 22px; height: 22px; border-radius: 50%; } } .el-icon-setting { height: 62px; width: 40px; padding: 11px; display: flex; cursor: pointer; align-items: center; &:hover { background: $menuHover; } } } .el-menu { border: none; height: 100%; background-color: transparent; width: 100% !important; } .el-menu-item, .el-sub-menu__title { color: $menuText; } .submenu-title-noDropdown, .el-sub-menu__title { height: 60px; background: $menuBg; &:hover { background-color: $menuHover !important; } } .is-active > .el-sub-menu__title, .is-active.submenu-title-noDropdown { color: $subMenuActiveText !important; border-bottom-color: #409eff; i { color: $subMenuActiveText !important; } } .is-active { transition: color 0.3s; color: $subMenuActiveText !important; border-bottom-color: #409eff; } } // vertical菜单折叠 .el-menu--vertical { .el-menu--popup { background-color: $subMenuBg !important; .el-menu-item { color: $menuText; background-color: $subMenuBg; span { font-size: 12px; margin-left: 10px; } &:hover { background-color: $subMenuHover; } } .el-sub-menu__title { color: $menuText; span { margin-left: 10px; } } } & > .el-menu { i { margin-right: 16px; } } .is-active > .el-sub-menu__title, .is-active.submenu-title-noDropdown { color: $subMenuActiveText !important; i { color: $subMenuActiveText !important; } } // 子菜单中还有子菜单 .el-menu .el-sub-menu__title { font-size: 12px; min-width: $sideBarWidth !important; background-color: $subMenuBg !important; &:hover { background-color: $menuHover !important; } } .is-active { transition: color 0.3s; color: $subMenuActiveText !important; } .nest-menu .el-sub-menu > .el-sub-menu__title, .el-menu-item { &:hover { background-color: $menuHover !important; } } .el-menu-item, .el-sub-menu { i { width: 20px; text-align: center; font-size: 16px; } i.fa { margin-right: 5px; font-size: 16px; } } } // horizontal菜单折叠 .el-menu--horizontal { .el-menu--popup { background-color: $subMenuBg !important; .el-menu-item { color: $menuText; background-color: $subMenuBg; span { font-size: 12px; margin-left: 10px; } &:hover { background-color: $subMenuHover; } } .el-sub-menu__title { color: $menuText; span { margin-left: 10px; } } } // 无子菜单时激活border-bottom .router-link-exact-active > .submenu-title-noDropdown { height: 60px; border-bottom: 2px solid var(--el-menu-active-color); } // 子菜单中还有子菜单 .el-menu .el-sub-menu__title { font-size: 12px; min-width: $sideBarWidth !important; background-color: $subMenuBg !important; &:hover { background-color: $menuHover !important; } } & > .el-menu { i { margin-right: 16px; } } .is-active > .el-sub-menu__title, .is-active.submenu-title-noDropdown { color: $subMenuActiveText !important; i { color: $subMenuActiveText !important; } } .is-active { transition: color 0.3s; color: $subMenuActiveText !important; } .nest-menu .el-sub-menu > .el-sub-menu__title, .el-menu-item { &:hover { background-color: $menuHover !important; } } } .el-scrollbar__wrap { overflow: auto; height: 100%; } .el-menu--collapse .el-menu .el-sub-menu { min-width: $sideBarWidth !important; } // 有子菜单 .el-menu--collapse .is-active.outer-most.el-sub-menu > .el-sub-menu__title::before { position: absolute; top: 0; left: 5px; width: 3px; height: 100%; background-color: #1890ff !important; content: ""; clear: both; -webkit-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out; -webkit-transform: translateY(0); transform: translateY(0); } // 无子菜单 .el-menu--collapse .is-active.submenu-title-noDropdown.outer-most::before { position: absolute; top: 0; left: 5px; width: 3px; height: 100%; background-color: #1890ff !important; content: ""; clear: both; -webkit-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out; -webkit-transform: translateY(0); transform: translateY(0); } .el-menu--collapse .outer-most.el-sub-menu > .el-sub-menu__title::before, .el-menu--collapse .submenu-title-noDropdown.outer-most::before { content: ""; display: block; position: absolute; height: 0; width: 3px; -webkit-transform: translateY(-50%); transform: translateY(-50%); top: 50%; } // 手机端 .mobile { .fixed-header { width: 100% !important; transition: width 0.28s; } .main-container { margin-left: 0; } .sidebar-container { transition: transform 0.28s; width: $sideBarWidth; } &.hideSidebar { .sidebar-container { pointer-events: none; transition-duration: 0.3s; transform: translate3d(-$sideBarWidth, 0, 0); } } } .withoutAnimation { .main-container, .sidebar-container { transition: none; } } } body[layout="vertical"] { $sideBarWidth: 210px; @include merge-style($sideBarWidth); .sidebar-logo-container { background: $sidebarLogo; } .hideSidebar { .fixed-header { width: calc(100% - 54px); transition: width 0.28s; } .sidebar-container { width: 54px !important; } .main-container { margin-left: 0; } .submenu-title-noDropdown { padding: 0 !important; position: relative; .el-tooltip { padding: 0 !important; } } .el-sub-menu { overflow: hidden; & > .el-sub-menu__title { .el-sub-menu__icon-arrow { display: none; } } } .el-menu--collapse { margin-left: -5px; //需优化的地方 .el-sub-menu { & > .el-sub-menu__title { & > span { height: 0; width: 0; overflow: hidden; visibility: hidden; display: inline-block; } } } } } } body[layout="horizontal"] { $sideBarWidth: 0; @include merge-style($sideBarWidth); .fixed-header { width: 100%; transition: none !important; } } // vertical模式下不隐藏标签页 body[layout="vertical"][data-show-tag="false"] { .fixed-header + .app-main { padding-top: 85px; } } // vertical模式下隐藏标签页 body[layout="vertical"][data-show-tag="true"] { .fixed-header + .app-main { padding-top: 48px; } } // horizontal模式下不隐藏标签页 body[layout="horizontal"][data-show-tag="false"] { .fixed-header + .app-main { padding-top: 98px; } } // horizontal模式下隐藏标签页 body[layout="horizontal"][data-show-tag="true"] { .fixed-header { box-shadow: 0 1px 4px rgb(0 21 41 / 8%); } .fixed-header + .app-main { padding-top: 62px; } }