sidebar.scss 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. #app {
  2. .main-container {
  3. height: 100%;
  4. transition: margin-left 0.28s;
  5. margin-left: $base-sidebar-width;
  6. position: relative;
  7. }
  8. .sidebarHide {
  9. margin-left: 0 !important;
  10. }
  11. .sidebar-container {
  12. -webkit-transition: width 0.28s;
  13. transition: width 0.28s;
  14. width: $base-sidebar-width !important;
  15. background-color: $base-menu-background;
  16. height: 100%;
  17. position: fixed;
  18. font-size: 0;
  19. top: 50px;
  20. bottom: 0;
  21. left: 0;
  22. z-index: 1001;
  23. overflow: hidden;
  24. -webkit-box-shadow: 2px 0 6px rgba(0, 21, 41, 0.35);
  25. box-shadow: 2px 0 6px rgba(0, 21, 41, 0.35);
  26. border-top-right-radius: 16px;
  27. // reset element-ui css
  28. .horizontal-collapse-transition {
  29. transition:
  30. 0s width ease-in-out,
  31. 0s padding-left ease-in-out,
  32. 0s padding-right ease-in-out;
  33. }
  34. .scrollbar-wrapper {
  35. overflow-x: hidden !important;
  36. }
  37. .el-scrollbar__bar.is-vertical {
  38. right: 0;
  39. }
  40. .el-scrollbar {
  41. height: 100%;
  42. }
  43. &.has-logo {
  44. .el-scrollbar {
  45. height: calc(100% - 50px);
  46. }
  47. }
  48. .is-horizontal {
  49. display: none;
  50. }
  51. a {
  52. display: inline-block;
  53. width: 100%;
  54. overflow: hidden;
  55. }
  56. .svg-icon {
  57. margin-right: 16px;
  58. }
  59. .el-menu {
  60. border: none;
  61. height: 100%;
  62. width: 100% !important;
  63. }
  64. .el-menu-item,
  65. .menu-title {
  66. overflow: hidden !important;
  67. text-overflow: ellipsis !important;
  68. white-space: nowrap !important;
  69. }
  70. .el-menu-item.is-active {
  71. background-color: #2c81ff;
  72. position: relative;
  73. .menu-title {
  74. color: #ffffff;
  75. }
  76. &::before {
  77. content: '';
  78. width: 4px;
  79. height: 100%;
  80. background-color: #fff;
  81. position: absolute;
  82. top: 0;
  83. left: 0;
  84. }
  85. }
  86. .el-sub-menu .el-menu-item.is-active {
  87. background-color: #2c81ff;
  88. position: relative;
  89. &::before {
  90. content: '';
  91. width: 4px;
  92. height: 100%;
  93. background-color: #fff;
  94. position: absolute;
  95. top: 0;
  96. left: 0;
  97. }
  98. }
  99. .is-opened {
  100. :deep(.el-sub-menu__title) {
  101. color: #fff !important;
  102. }
  103. }
  104. .el-menu-item .el-menu-tooltip__trigger {
  105. display: inline-block !important;
  106. }
  107. // menu hover
  108. .theme-dark .sub-menu-title-noDropdown,
  109. .theme-dark .el-sub-menu__title {
  110. &:hover {
  111. color: #fff !important;
  112. background-color: $base-sub-menu-title-hover !important;
  113. }
  114. }
  115. .sub-menu-title-noDropdown,
  116. .el-sub-menu__title {
  117. &:hover {
  118. color: #fff;
  119. background-color: #2c81ff !important;
  120. position: relative;
  121. &::before {
  122. content: '';
  123. width: 4px;
  124. height: 100%;
  125. background-color: #fff;
  126. position: absolute;
  127. top: 0;
  128. left: 0;
  129. }
  130. }
  131. }
  132. & .theme-dark .is-active > .el-sub-menu__title {
  133. color: $base-menu-color-active !important;
  134. }
  135. & .nest-menu .el-sub-menu > .el-sub-menu__title,
  136. & .el-sub-menu .el-menu-item {
  137. min-width: $base-sidebar-width !important;
  138. &:hover {
  139. position: relative;
  140. background-color: #2c81ff !important;
  141. .el-sub-menu__title, .menu-title {
  142. color: #ffffff !important;
  143. }
  144. &::before {
  145. content: '';
  146. width: 4px;
  147. height: 100%;
  148. background-color: #fff;
  149. position: absolute;
  150. top: 0;
  151. left: 0;
  152. }
  153. }
  154. }
  155. & .theme-dark .nest-menu .el-sub-menu > .el-sub-menu__title,
  156. & .theme-dark .el-sub-menu .el-menu-item {
  157. background-color: $base-sub-menu-background !important;
  158. &:hover {
  159. position: relative;
  160. background-color: #2c81ff !important;
  161. color: #fff;
  162. &::before {
  163. content: '';
  164. width: 4px;
  165. height: 100%;
  166. background-color: #fff;
  167. position: absolute;
  168. top: 0;
  169. left: 0;
  170. }
  171. }
  172. }
  173. //& .theme-dark .nest-menu .el-sub-menu > .el-sub-menu__title,
  174. & .theme-dark .el-sub-menu .el-menu-item.is-active {
  175. background-color: #2c81ff !important;
  176. }
  177. & .theme-dark .nest-menu .el-sub-menu > .el-sub-menu__title,
  178. & .theme-dark .el-menu-item {
  179. &:hover {
  180. // you can use $sub-menuHover
  181. position: relative;
  182. background-color: #2c81ff !important;
  183. &::before {
  184. content: '';
  185. width: 4px;
  186. height: 100%;
  187. background-color: #fff;
  188. position: absolute;
  189. top: 0;
  190. left: 0;
  191. }
  192. }
  193. }
  194. & .nest-menu .el-sub-menu > .el-sub-menu__title,
  195. & .el-menu-item {
  196. &:hover {
  197. // you can use $sub-menuHover
  198. position: relative;
  199. background-color: #2c81ff !important;
  200. color: #ffffff;
  201. &::before {
  202. content: '';
  203. width: 4px;
  204. height: 100%;
  205. background-color: #fff;
  206. position: absolute;
  207. top: 0;
  208. left: 0;
  209. }
  210. }
  211. }
  212. }
  213. .hideSidebar {
  214. .sidebar-container {
  215. width: 54px !important;
  216. }
  217. .main-container {
  218. margin-left: 54px;
  219. }
  220. .sub-menu-title-noDropdown {
  221. padding: 0 !important;
  222. position: relative;
  223. .el-tooltip {
  224. padding: 0 !important;
  225. .svg-icon {
  226. margin-left: 20px;
  227. }
  228. }
  229. }
  230. .el-sub-menu {
  231. overflow: hidden;
  232. & > .el-sub-menu__title {
  233. padding: 0 !important;
  234. .svg-icon {
  235. margin-left: 20px;
  236. }
  237. }
  238. }
  239. .el-menu--collapse {
  240. .el-sub-menu {
  241. & > .el-sub-menu__title {
  242. & > span {
  243. height: 0;
  244. width: 0;
  245. overflow: hidden;
  246. visibility: hidden;
  247. display: inline-block;
  248. }
  249. & > i {
  250. height: 0;
  251. width: 0;
  252. overflow: hidden;
  253. visibility: hidden;
  254. display: inline-block;
  255. }
  256. }
  257. }
  258. }
  259. }
  260. .el-menu--collapse .el-menu .el-sub-menu {
  261. min-width: $base-sidebar-width !important;
  262. }
  263. // mobile responsive
  264. .mobile {
  265. .main-container {
  266. margin-left: 0px;
  267. }
  268. .sidebar-container {
  269. transition: transform 0.28s;
  270. width: $base-sidebar-width !important;
  271. }
  272. &.hideSidebar {
  273. .sidebar-container {
  274. pointer-events: none;
  275. transition-duration: 0.3s;
  276. transform: translate3d(-$base-sidebar-width, 0, 0);
  277. }
  278. }
  279. }
  280. .withoutAnimation {
  281. .main-container,
  282. .sidebar-container {
  283. transition: none;
  284. }
  285. }
  286. }
  287. // when menu collapsed
  288. .el-menu--vertical {
  289. & > .el-menu {
  290. .svg-icon {
  291. margin-right: 16px;
  292. }
  293. }
  294. }