sidebar.scss 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. #app {
  2. // 主体区域 Main container
  3. .main-container {
  4. min-height: 100%;
  5. transition: margin-left .28s;
  6. margin-left: $sideBarWidth;
  7. position: relative;
  8. }
  9. // 侧边栏 Sidebar container
  10. .sidebar-container {
  11. transition: width 0.28s;
  12. width: $sideBarWidth !important;
  13. height: 100%;
  14. position: fixed;
  15. font-size: 0;
  16. top: 0;
  17. bottom: 0;
  18. left: 0;
  19. z-index: 1001;
  20. overflow: hidden;
  21. //reset element-ui css
  22. .horizontal-collapse-transition {
  23. transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out;
  24. }
  25. .scrollbar-wrapper {
  26. overflow-x: hidden !important;
  27. .el-scrollbar__view {
  28. height: 100%;
  29. }
  30. }
  31. .el-scrollbar__bar.is-vertical {
  32. right: 0;
  33. }
  34. .is-horizontal {
  35. display: none;
  36. }
  37. a {
  38. display: inline-block;
  39. width: 100%;
  40. overflow: hidden;
  41. }
  42. .svg-icon {
  43. margin-right: 16px;
  44. }
  45. .el-menu {
  46. border: none;
  47. height: 100%;
  48. width: 100% !important;
  49. }
  50. // menu hover
  51. .submenu-title-noDropdown,
  52. .el-submenu__title {
  53. &:hover {
  54. background-color: $menuHover !important;
  55. }
  56. }
  57. .is-active>.el-submenu__title {
  58. color: $subMenuActiveText !important;
  59. }
  60. & .nest-menu .el-submenu>.el-submenu__title,
  61. & .el-submenu .el-menu-item {
  62. min-width: $sideBarWidth !important;
  63. background-color: $subMenuBg !important;
  64. &:hover {
  65. background-color: $subMenuHover !important;
  66. }
  67. }
  68. }
  69. .hideSidebar {
  70. .sidebar-container {
  71. width: 54px !important;
  72. }
  73. .main-container {
  74. margin-left: 54px;
  75. }
  76. .svg-icon {
  77. margin-right: 0;
  78. }
  79. .submenu-title-noDropdown {
  80. padding: 0 !important;
  81. position: relative;
  82. .el-tooltip {
  83. padding: 0 !important;
  84. .svg-icon {
  85. margin-left: 20px;
  86. }
  87. }
  88. }
  89. .el-submenu {
  90. overflow: hidden;
  91. &>.el-submenu__title {
  92. padding: 0 !important;
  93. .svg-icon {
  94. margin-left: 20px;
  95. }
  96. .el-submenu__icon-arrow {
  97. display: none;
  98. }
  99. }
  100. }
  101. .el-menu--collapse {
  102. .el-submenu {
  103. &>.el-submenu__title {
  104. &>span {
  105. height: 0;
  106. width: 0;
  107. overflow: hidden;
  108. visibility: hidden;
  109. display: inline-block;
  110. }
  111. }
  112. }
  113. }
  114. }
  115. .el-menu--collapse .el-menu .el-submenu {
  116. min-width: $sideBarWidth !important;
  117. }
  118. // 适配移动端, Mobile responsive
  119. .mobile {
  120. .main-container {
  121. margin-left: 0;
  122. }
  123. .sidebar-container {
  124. transition: transform .28s;
  125. width: $sideBarWidth !important;
  126. }
  127. &.hideSidebar {
  128. .sidebar-container {
  129. pointer-events: none;
  130. transition-duration: 0.3s;
  131. transform: translate3d(-$sideBarWidth, 0, 0);
  132. }
  133. }
  134. }
  135. .withoutAnimation {
  136. .main-container,
  137. .sidebar-container {
  138. transition: none;
  139. }
  140. }
  141. }
  142. // when menu collapsed
  143. .el-menu--vertical {
  144. &>.el-menu {
  145. .svg-icon {
  146. margin-right: 16px;
  147. }
  148. }
  149. .nest-menu .el-submenu>.el-submenu__title,
  150. .el-menu-item {
  151. &:hover {
  152. // you can use $subMenuHover
  153. background-color: $menuHover !important;
  154. }
  155. }
  156. // the scroll bar appears when the subMenu is too long
  157. >.el-menu--popup {
  158. max-height: 100vh;
  159. overflow-y: auto;
  160. &::-webkit-scrollbar-track-piece {
  161. background: #d3dce6;
  162. }
  163. &::-webkit-scrollbar {
  164. width: 6px;
  165. }
  166. &::-webkit-scrollbar-thumb {
  167. background: #99a9bf;
  168. border-radius: 20px;
  169. }
  170. }
  171. }