sidebar.scss 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. @mixin merge-style(
  2. /* vertical模式下主体内容距离网页文档左侧的距离 */ $sideBarWidth
  3. ) {
  4. $menuActiveText: #7a80b4;
  5. @media screen and (min-width: 150px) and (max-width: 420px) {
  6. .app-main-nofixed-header {
  7. overflow-y: hidden;
  8. }
  9. }
  10. @media screen and (min-width: 420px) {
  11. .app-main-nofixed-header {
  12. overflow: hidden;
  13. }
  14. }
  15. .sub-menu-icon {
  16. vertical-align: middle;
  17. font-size: 18px;
  18. display: inline-flex;
  19. justify-content: center;
  20. align-items: center;
  21. margin-right: 5px;
  22. }
  23. .main-container {
  24. height: 100vh;
  25. min-height: 100%;
  26. /* main-content属性动画 */
  27. transition: margin-left var(--pure-transition-duration);
  28. margin-left: $sideBarWidth;
  29. position: relative;
  30. background: #f0f2f5;
  31. .el-scrollbar__wrap {
  32. overflow: auto;
  33. height: 100%;
  34. }
  35. }
  36. .fixed-header {
  37. position: fixed;
  38. top: 0;
  39. right: 0;
  40. z-index: 998;
  41. width: calc(100% - 210px);
  42. /* fixed-header属性左上角动画 */
  43. transition: width var(--pure-transition-duration);
  44. }
  45. .main-hidden {
  46. margin-left: 0 !important;
  47. .fixed-header {
  48. width: 100% !important;
  49. + .app-main {
  50. padding-top: 37px !important;
  51. }
  52. }
  53. }
  54. .el-popper.is-light {
  55. border: none !important;
  56. }
  57. .sidebar-container {
  58. /* 展开动画 */
  59. transition: width var(--pure-transition-duration);
  60. width: $sideBarWidth !important;
  61. background: $menuBg;
  62. height: 100%;
  63. position: fixed;
  64. font-size: 0;
  65. top: 0;
  66. bottom: 0;
  67. left: 0;
  68. z-index: 1001;
  69. overflow: hidden;
  70. box-shadow: 0 0 1px #888;
  71. .scrollbar-wrapper {
  72. overflow-x: hidden !important;
  73. }
  74. .el-scrollbar__bar.is-vertical {
  75. right: 0;
  76. }
  77. .el-scrollbar {
  78. height: calc(100% - 44px);
  79. }
  80. &.has-logo {
  81. .el-scrollbar.pc {
  82. /* logo: 48px、leftCollapse: 40px、leftCollapse-shadow: 4px */
  83. height: calc(100% - 92px);
  84. }
  85. .el-scrollbar.mobile {
  86. height: 100%;
  87. }
  88. }
  89. .is-horizontal {
  90. display: none;
  91. }
  92. a {
  93. display: inline-block;
  94. display: flex;
  95. padding-left: 10px;
  96. flex-wrap: wrap;
  97. width: 100%;
  98. }
  99. .el-menu {
  100. border: none;
  101. height: 100%;
  102. background-color: transparent !important;
  103. }
  104. .el-menu-item,
  105. .el-sub-menu__title {
  106. height: 50px;
  107. color: $menuText;
  108. background-color: transparent !important;
  109. &:hover {
  110. color: $menuTitleHover !important;
  111. }
  112. div,
  113. span {
  114. height: 50px;
  115. line-height: 50px;
  116. }
  117. }
  118. .submenu-title-noDropdown,
  119. .el-sub-menu__title {
  120. &:hover {
  121. background-color: transparent;
  122. }
  123. }
  124. .is-active > .el-sub-menu__title,
  125. .is-active.submenu-title-noDropdown {
  126. color: $subMenuActiveText !important;
  127. i {
  128. color: $subMenuActiveText !important;
  129. }
  130. }
  131. .is-active {
  132. transition: color 0.3s;
  133. color: $subMenuActiveText !important;
  134. }
  135. .el-menu .el-menu--inline .el-sub-menu__title,
  136. & .el-sub-menu .el-menu-item {
  137. font-size: 12px;
  138. min-width: $sideBarWidth !important;
  139. background-color: $subMenuBg !important;
  140. }
  141. /* 无子集的激活菜单背景 */
  142. .is-active.submenu-title-noDropdown.outer-most {
  143. background: $subMenuActiveBg !important;
  144. }
  145. /* 有子集的激活菜单背景 */
  146. .is-active.nest-menu {
  147. background: $subMenuActiveBg !important;
  148. }
  149. }
  150. .horizontal-header {
  151. display: flex;
  152. justify-content: space-around;
  153. background: $menuBg;
  154. width: 100%;
  155. height: 48px;
  156. align-items: center;
  157. .horizontal-header-left {
  158. display: flex;
  159. height: 100%;
  160. width: auto;
  161. min-width: 200px;
  162. align-items: center;
  163. padding-left: 10px;
  164. cursor: pointer;
  165. transition: all 0.125s ease;
  166. i {
  167. font-size: 30px;
  168. color: #1890ff;
  169. margin-right: 4px;
  170. }
  171. h4 {
  172. font-size: 16px;
  173. font-weight: 700;
  174. color: $subMenuActiveText;
  175. transition: all 0.5s;
  176. }
  177. }
  178. .horizontal-header-menu {
  179. height: 100%;
  180. min-width: 0;
  181. flex: 1;
  182. align-items: center;
  183. }
  184. .horizontal-header-right {
  185. display: flex;
  186. min-width: 340px;
  187. align-items: center;
  188. color: $subMenuActiveText;
  189. justify-content: flex-end;
  190. /* 搜索 */
  191. .search-container,
  192. /* 告警 */
  193. .dropdown-badge,
  194. /* 全屏 */
  195. .screen-full,
  196. /* 国际化 */
  197. .globalization,
  198. /* 登录名 */
  199. .el-dropdown-link,
  200. /* 设置 */
  201. .el-icon-setting {
  202. &:hover {
  203. background: $menuHover;
  204. }
  205. }
  206. .dropdown-badge {
  207. height: 48px;
  208. color: $subMenuActiveText;
  209. }
  210. .globalization {
  211. width: 40px;
  212. height: 48px;
  213. padding: 11px;
  214. outline: none;
  215. cursor: pointer;
  216. color: $subMenuActiveText;
  217. }
  218. .el-dropdown-link {
  219. height: 48px;
  220. padding: 10px;
  221. display: flex;
  222. cursor: pointer;
  223. align-items: center;
  224. justify-content: space-around;
  225. color: $subMenuActiveText;
  226. p {
  227. font-size: 14px;
  228. }
  229. img {
  230. width: 22px;
  231. height: 22px;
  232. border-radius: 50%;
  233. }
  234. }
  235. .el-icon-setting {
  236. height: 48px;
  237. width: 40px;
  238. padding: 12px;
  239. display: flex;
  240. cursor: pointer;
  241. align-items: center;
  242. }
  243. }
  244. .el-menu {
  245. border: none;
  246. height: 100%;
  247. width: 100% !important;
  248. background-color: transparent;
  249. }
  250. .el-menu-item,
  251. .el-sub-menu__title {
  252. color: $menuText;
  253. &:hover {
  254. color: $menuTitleHover !important;
  255. }
  256. }
  257. .submenu-title-noDropdown,
  258. .el-sub-menu__title {
  259. height: 48px;
  260. line-height: 48px;
  261. background: $menuBg;
  262. svg {
  263. position: static !important;
  264. }
  265. }
  266. .is-active > .el-sub-menu__title,
  267. .is-active.submenu-title-noDropdown {
  268. color: $subMenuActiveText !important;
  269. i {
  270. color: $subMenuActiveText !important;
  271. }
  272. }
  273. .is-active {
  274. transition: color 0.3s;
  275. color: $subMenuActiveText !important;
  276. }
  277. }
  278. /* vertical菜单折叠 */
  279. .el-menu--vertical {
  280. .el-menu--popup {
  281. background-color: $subMenuBg !important;
  282. .el-menu-item {
  283. span {
  284. font-size: 12px;
  285. }
  286. }
  287. }
  288. & > .el-menu {
  289. i {
  290. margin-right: 20px;
  291. }
  292. }
  293. .is-active > .el-sub-menu__title,
  294. .is-active.submenu-title-noDropdown {
  295. color: $subMenuActiveText !important;
  296. i {
  297. color: $subMenuActiveText !important;
  298. }
  299. }
  300. /* 子菜单中还有子菜单 */
  301. .el-menu .el-sub-menu__title {
  302. font-size: 12px;
  303. min-width: $sideBarWidth !important;
  304. background-color: $subMenuBg !important;
  305. }
  306. .el-menu-item,
  307. .el-sub-menu__title {
  308. height: 50px;
  309. line-height: 50px;
  310. color: $menuText;
  311. background-color: $subMenuBg;
  312. &:hover {
  313. color: $menuTitleHover !important;
  314. }
  315. }
  316. .is-active {
  317. transition: color 0.3s;
  318. color: $subMenuActiveText !important;
  319. }
  320. .el-menu-item.is-active.nest-menu {
  321. background: $subMenuActiveBg !important;
  322. }
  323. .el-menu-item,
  324. .el-sub-menu {
  325. // i {
  326. // width: 20px;
  327. // text-align: center;
  328. // font-size: 16px;
  329. // }
  330. // i.fa {
  331. // margin-right: 5px;
  332. // font-size: 16px;
  333. // }
  334. .el-menu-tooltip__trigger {
  335. width: 54px;
  336. padding: 18px !important;
  337. }
  338. }
  339. }
  340. /* horizontal菜单 */
  341. .el-menu--horizontal {
  342. & > .el-sub-menu .el-sub-menu__icon-arrow {
  343. position: static !important;
  344. margin-top: 0;
  345. }
  346. .el-menu--popup {
  347. background-color: $subMenuBg !important;
  348. .el-menu-item {
  349. color: $menuText;
  350. background-color: $subMenuBg;
  351. span {
  352. font-size: 12px;
  353. }
  354. }
  355. .el-sub-menu__title {
  356. color: $menuText;
  357. }
  358. }
  359. /* 无子菜单时激活border-bottom */
  360. .router-link-exact-active > .submenu-title-noDropdown {
  361. height: 60px;
  362. border-bottom: 2px solid var(--el-menu-active-color);
  363. }
  364. /* 子菜单中还有子菜单 */
  365. .el-menu .el-sub-menu__title {
  366. font-size: 12px;
  367. min-width: $sideBarWidth !important;
  368. background-color: $subMenuBg !important;
  369. &:hover {
  370. color: $menuTitleHover !important;
  371. }
  372. }
  373. .is-active > .el-sub-menu__title,
  374. .is-active.submenu-title-noDropdown {
  375. color: $subMenuActiveText !important;
  376. i {
  377. color: $subMenuActiveText !important;
  378. }
  379. }
  380. .nest-menu .el-sub-menu > .el-sub-menu__title,
  381. .el-menu-item {
  382. &:hover {
  383. color: $menuTitleHover !important;
  384. }
  385. }
  386. /* 有子集的激活菜单背景 */
  387. .is-active.nest-menu {
  388. background: $subMenuActiveBg !important;
  389. }
  390. .el-menu-item.is-active {
  391. transition: color 0.3s;
  392. color: $subMenuActiveText !important;
  393. }
  394. }
  395. .el-menu--collapse .el-menu .el-sub-menu {
  396. min-width: $sideBarWidth !important;
  397. }
  398. /* 有子菜单 */
  399. .el-menu--collapse
  400. .is-active.outer-most.el-sub-menu
  401. > .el-sub-menu__title::before,
  402. /* 无子菜单 */
  403. .el-menu--collapse .is-active.submenu-title-noDropdown.outer-most::before {
  404. position: absolute;
  405. top: 0;
  406. left: 2px;
  407. width: 2px;
  408. height: 100%;
  409. background-color: $menuActiveBefore;
  410. content: "";
  411. clear: both;
  412. transition: all 0.125s ease-in-out;
  413. transform: translateY(0);
  414. }
  415. .el-menu--collapse .outer-most.el-sub-menu > .el-sub-menu__title::before,
  416. .el-menu--collapse .submenu-title-noDropdown.outer-most::before {
  417. content: "";
  418. display: block;
  419. position: absolute;
  420. height: 0;
  421. width: 3px;
  422. transform: translateY(-50%);
  423. top: 50%;
  424. }
  425. /* 手机端 */
  426. .mobile {
  427. .fixed-header {
  428. width: 100% !important;
  429. transition: width var(--pure-transition-duration);
  430. }
  431. .main-container {
  432. margin-left: 0 !important;
  433. }
  434. .sidebar-container {
  435. transition: transform var(--pure-transition-duration);
  436. width: $sideBarWidth;
  437. }
  438. &.hideSidebar {
  439. .sidebar-container {
  440. pointer-events: none;
  441. transition-duration: 0.3s;
  442. transform: translate3d(-$sideBarWidth, 0, 0);
  443. }
  444. }
  445. }
  446. }
  447. body[layout="vertical"] {
  448. $sideBarWidth: 210px;
  449. @include merge-style($sideBarWidth);
  450. .el-menu--collapse {
  451. width: 54px;
  452. }
  453. .sidebar-logo-container {
  454. background: $sidebarLogo;
  455. }
  456. .hideSidebar {
  457. .fixed-header {
  458. width: calc(100% - 54px);
  459. transition: width var(--pure-transition-duration);
  460. }
  461. .sidebar-container {
  462. transition: width 0.125s;
  463. width: 54px !important;
  464. .is-active.submenu-title-noDropdown.outer-most {
  465. background: transparent !important;
  466. }
  467. }
  468. .main-container {
  469. margin-left: 54px;
  470. }
  471. /* 菜单折叠 */
  472. .el-menu--collapse {
  473. .el-sub-menu {
  474. & > .el-sub-menu__title {
  475. & > span {
  476. height: 0;
  477. width: 0;
  478. overflow: hidden;
  479. visibility: hidden;
  480. display: inline-block;
  481. }
  482. }
  483. }
  484. .submenu-title-noDropdown {
  485. background: transparent !important;
  486. }
  487. .el-sub-menu__title {
  488. padding: 0 18px !important;
  489. }
  490. }
  491. .sub-menu-icon {
  492. margin-right: 0;
  493. }
  494. }
  495. /* 搜索 */
  496. .search-container,
  497. /* 告警 */
  498. .dropdown-badge,
  499. /* 全屏 */
  500. .screen-full,
  501. /* 国际化 */
  502. .globalization,
  503. /* 登录名 */
  504. .el-dropdown-link,
  505. /* 设置 */
  506. .el-icon-setting {
  507. &:hover {
  508. background: #f6f6f6;
  509. }
  510. }
  511. }
  512. body[layout="horizontal"] {
  513. $sideBarWidth: 0;
  514. @include merge-style($sideBarWidth);
  515. .fixed-header {
  516. width: 100%;
  517. transition: none !important;
  518. }
  519. }
  520. body[layout="mix"] {
  521. $sideBarWidth: 210px;
  522. @include merge-style($sideBarWidth);
  523. .el-menu--collapse {
  524. width: 54px;
  525. }
  526. .el-menu {
  527. --el-menu-hover-bg-color: transparent !important;
  528. }
  529. .hideSidebar {
  530. .fixed-header {
  531. width: calc(100% - 54px);
  532. transition: width var(--pure-transition-duration);
  533. }
  534. .sidebar-container {
  535. transition: width 0.125s;
  536. width: 54px !important;
  537. .is-active.submenu-title-noDropdown.outer-most {
  538. background: transparent !important;
  539. }
  540. }
  541. .main-container {
  542. margin-left: 54px;
  543. }
  544. /* 菜单折叠 */
  545. .el-menu--collapse {
  546. .el-sub-menu {
  547. & > .el-sub-menu__title {
  548. & > span {
  549. height: 0;
  550. width: 0;
  551. overflow: hidden;
  552. visibility: hidden;
  553. display: inline-block;
  554. }
  555. }
  556. }
  557. }
  558. }
  559. }