Blame view

src/styles/sidebar.scss 6.39 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
    bottom: 0;
    left: 0;
任超 committed
17
    z-index: 80;
任超 committed
18
    background-color: $subMenuBg;
任超 committed
19
    // overflow: hidden;
赵千 committed
20 21 22 23 24 25 26 27

    .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;
任超 committed
28
      // overflow-y: auto;
赵千 committed
29
      margin-right: 0 !important;
任超 committed
30
      height: 90vh;
赵千 committed
31 32 33 34 35 36 37 38 39 40 41 42 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

      &::-webkit-scrollbar {
        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%;
      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
73 74
        color: $subMenuActiveText !important;
        background-color: $subMenuHover !important;
赵千 committed
75 76 77 78

        .svg-icon,
        i,
        span {
任超 committed
79
          color: $subMenuActiveText !important;
赵千 committed
80 81 82 83 84 85 86
        }
      }
    }

    // 没有子级
    .submenu-title-noDropdown {
      color: $menuText;
任超 committed
87 88
      border-radius: 6px;
      padding-left: 10px !important;
赵千 committed
89 90

      &:hover {
任超 committed
91 92
        color: $menuActiveText !important;
        background-color: $subMenuHover !important;
赵千 committed
93 94 95 96 97 98 99 100 101 102 103 104 105

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

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

    .submenu-title-noDropdown.is-active,
    .el-submenu__title.is-active {
任超 committed
106 107
      color: $menuActiveText;
      background-color: $menuHover !important;
赵千 committed
108 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,
    .el-submenu__title {
      font-weight: 600;
      font-size: $sideBarFontSize;
任超 committed
122
      margin: 0 10px;
任超 committed
123
      border-radius: 6px;
赵千 committed
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154

      >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
155 156
        background-color: $subMenuHover !important;
        color: $menuActiveText !important;
赵千 committed
157 158 159
      }

      &:hover {
任超 committed
160 161
        background-color: $subMenuHover !important;
        color: $menuActiveText !important;
赵千 committed
162 163
      }

任超 committed
164
      min-width: 130px !important;
赵千 committed
165 166 167
      background-color: transparent !important;
      font-weight: 600;
      font-size: $sideBarFontSize;
任超 committed
168
      margin: 0 10px;
任超 committed
169
      border-radius: 6px;
赵千 committed
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 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
    }
  }

  .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
287 288
    background-color: $menuHover !important;
    color: $menuText !important;
赵千 committed
289 290

    &:hover {
任超 committed
291 292
      background-color: $menuHover !important;
      opacity: .9;
赵千 committed
293 294 295 296

      .svg-icon,
      i,
      span {
任超 committed
297
        color: $menuText;
赵千 committed
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325
      }
    }
  }

  // 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;
    }
  }
}