Blame view

src/styles/sidebar.scss 6.6 KB
赵千 committed
1 2
#app {
  .main-container {
任超 committed
3
    height: calc(100% - 80px);
赵千 committed
4 5 6 7 8 9 10
    transition: margin-left 0.28s;
    margin-left: $sideBarWidth;
  }

  .sidebar-container {
    transition: width 0.28s;
    width: $sideBarWidth !important;
任超 committed
11
    height: calc(100% - #{$headerHeight});
赵千 committed
12 13
    position: fixed;
    font-size: 0px;
任超 committed
14
    top: $headerHeight;
赵千 committed
15 16 17
    bottom: 0;
    left: 0;
    z-index: 1001;
任超 committed
18
    background-color: $subMenuBg;
赵千 committed
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
    overflow: hidden;

    .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;
      overflow-y: auto;
      margin-right: 0 !important;

      &::-webkit-scrollbar {
        display: none;
      }
    }

    .el-scrollbar__bar.is-vertical {
      right: 0px;
    }

    .el-scrollbar {
任超 committed
41 42
      height: 100%;

赵千 committed
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
      &::-webkit-scrollbar {
        display: none;
      }
    }

    .is-horizontal {
      display: none;
    }

    a {
      display: inline-block;
      width: 100%;
      overflow: hidden;
    }

    .svg-icon {
      margin-right: 10px;
    }

    .sub-el-icon {
      margin-right: 12px;
      margin-left: -2px;
    }

    .el-menu {
      background-color: transparent !important;
      border: none;
      height: 100%;
      // overflow-y: auto;
      width: 100% !important;
    }

    // menu hover
    .el-menu--collapse .el-submenu__title,
    .el-menu--collapse .submenu-title-noDropdown {
      margin-left: 0px !important;
    }

    // 有子级
    .el-submenu__title {
      margin-left: 13px;
      padding-left: 10px !important;
      color: $menuText;
      background-color: transparent !important;

      &:hover {
任超 committed
89 90
        color: $subMenuActiveText !important;
        background-color: $subMenuHover !important;
赵千 committed
91 92 93 94

        .svg-icon,
        i,
        span {
任超 committed
95
          color: $subMenuActiveText !important;
赵千 committed
96 97 98 99 100 101 102
        }
      }
    }

    // 没有子级
    .submenu-title-noDropdown {
      color: $menuText;
任超 committed
103 104
      border-radius: 6px;
      padding-left: 10px !important;
赵千 committed
105 106

      &:hover {
任超 committed
107 108
        color: $menuActiveText !important;
        background-color: $subMenuHover !important;
赵千 committed
109 110 111 112 113 114 115 116 117 118 119 120 121

        .svg-icon {
          color: #1ea6f8 !important;
        }

        i {
          color: #1ea6f8 !important;
        }
      }
    }

    .submenu-title-noDropdown.is-active,
    .el-submenu__title.is-active {
任超 committed
122 123
      color: $menuActiveText;
      background-color: $menuHover !important;
赵千 committed
124 125 126 127 128 129 130 131 132 133 134 135 136 137

      .svg-icon {
        color: #1ea6f8 !important;
      }

      i {
        color: #1ea6f8 !important;
      }
    }

    .submenu-title-noDropdown,
    .el-submenu__title {
      font-weight: 600;
      font-size: $sideBarFontSize;
任超 committed
138
      margin: 0 10px;
任超 committed
139
      border-radius: 6px;
赵千 committed
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170

      >i {
        color: $subMenuActiveText !important;
        transform: rotate(90deg);
        -webkit-transform: rotate(90deg);
        -moz-transform: rotate(90deg);
        -ms-transform: rotate(90deg);
        -o-transform: rotate(90deg);
        margin-right: 10px;
      }

      .svg-icon {
        font-size: 18px;
      }
    }

    .el-submenu.is-opened>.el-submenu__title .el-submenu__icon-arrow {
      transform: rotateZ(0deg) !important;
      -webkit-transform: rotateZ(0deg) !important;
      -moz-transform: rotateZ(0deg) !important;
      -ms-transform: rotateZ(0deg) !important;
      -o-transform: rotateZ(0deg) !important;
    }

    .is-active>.el-submenu__title {
      color: #fff !important;
    }

    & .nest-menu .el-submenu>.el-submenu__title,
    & .el-submenu .el-menu-item {
      &.is-active {
任超 committed
171 172
        background-color: $subMenuHover !important;
        color: $menuActiveText !important;
赵千 committed
173 174 175
      }

      &:hover {
任超 committed
176 177
        background-color: $subMenuHover !important;
        color: $menuActiveText !important;
赵千 committed
178 179
      }

任超 committed
180
      min-width: 130px !important;
赵千 committed
181 182 183
      background-color: transparent !important;
      font-weight: 600;
      font-size: $sideBarFontSize;
任超 committed
184
      margin: 0 10px;
任超 committed
185
      border-radius: 6px;
赵千 committed
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
    }
  }

  .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: 16px;
        }

        .sub-el-icon {
          margin-left: 19px;
        }
      }
    }

    .el-submenu {
      overflow: hidden;

      &>.el-submenu__title {
        padding: 0 !important;

        .svg-icon {
          margin-left: 16px;
        }

        .sub-el-icon {
          margin-left: 19px;
        }

        .el-submenu__icon-arrow {
          display: none;
        }
      }
    }

    .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: $sideBarWidth !important;
  }

  // mobile responsive
  .mobile {
    .main-container {
      margin-left: 0px;
    }

    .sidebar-container {
      transition: transform 0.28s;
      width: $sideBarWidth !important;
    }

    &.hideSidebar {
      .sidebar-container {
        pointer-events: none;
        transition-duration: 0.3s;
        transform: translate3d(-$sideBarWidth, 0, 0);
      }
    }
  }

  .withoutAnimation {

    .main-container,
    .sidebar-container {
      transition: none;
    }
  }
}

// when menu collapsed
.el-menu--vertical {
  &>.el-menu {
    .svg-icon {
      margin-right: 16px;
    }

    .sub-el-icon {
      margin-right: 12px;
      margin-left: -2px;
    }
  }

  .nest-menu .el-submenu>.el-submenu__title,
  .el-menu-item {
    width: calc(100% - 12px);
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    font-weight: 600 !important;
    font-size: 15px !important;
任超 committed
303 304
    background-color: $menuHover !important;
    color: $menuText !important;
赵千 committed
305 306

    &:hover {
任超 committed
307 308
      background-color: $menuHover !important;
      opacity: .9;
赵千 committed
309 310 311 312

      .svg-icon,
      i,
      span {
任超 committed
313
        color: $menuText;
赵千 committed
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341
      }
    }
  }

  // the scroll bar appears when the subMenu is too long
  >.el-menu--popup {
    max-height: 100vh;
    overflow-y: auto;
    background-color: #32ACFE !important;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    min-width: 140px;
    padding: 12px 0;

    &::-webkit-scrollbar-track-piece {
      background: #d3dce6;
    }

    &::-webkit-scrollbar {
      width: 6px;
    }

    &::-webkit-scrollbar-thumb {
      background: #99a9bf;
      border-radius: 20px;
    }
  }
}