sbSidebar.scss 7.04 KB
@import "~@/styles/_handle.scss";

.main-container {
  width: 100%;
  height: calc(100% - 74px);
  transition: margin-left 0.28s;
  display: flex;
}

.el-form-item__content {
  margin-left: 0 !important;
}

.sidebar-container {
  transition: width 0.28s;
  width: $sideBarWidth !important;
  font-size: 0px;
  @include background_color("menuBg");

  .horizontal-collapse-transition {
    transition: 0s width ease-in-out, 0s padding-left ease-in-out,
      0s padding-right ease-in-out;
  }

  .el-scrollbar {
    height: 100%;
  }

  .scrollbar-wrapper {
    overflow-x: hidden !important;
    margin-right: 0 !important;

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

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

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

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

  .el-menu {
    background-color: transparent !important;
    border: none;
    @include font_color("menuText");
    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 {
    @include font_color("menuText");
    background-color: transparent !important;

    &:hover {
      color: $subMenuActiveText !important;
      @include font_color("submenuColor");
      border-right: 5px solid #36CEB6;
      @include background_color("submenuBg");
      box-sizing: border-box;

      .svg-icon,
      i,
      span {
        @include font_color("submenuColor");
      }
    }
  }

  // 没有子级
  .submenu-title-noDropdown {
    @include font_color("menuText");
    padding-left: 20px;
    height: 56px;
    background-color: transparent !important;

    &:hover {
      @include font_color("submenuColor");
      @include background_color("submenuBg");
      border-right: 5px solid #36CEB6;
      box-sizing: border-box;

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

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

  .submenu-title-noDropdown.is-active,
  .el-submenu__title.is-active {
    @include background_color("submenuBg");
    @include font_color("submenuColor");
    border-right: 5px solid #36CEB6;
    box-sizing: border-box;
    .svg-icon {
      color: #1ea6f8 !important;
    }

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

  .submenu-title-noDropdown,
  .el-submenu__title {
    font-weight: 600;
    font-size: $sideBarFontSize;

    >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;
      color: #6D7278 !important;
    }
  }

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

  & .nest-menu .el-submenu>.el-submenu__title,
  & .el-submenu .el-menu-item {

    &.is-active {
      @include background_color("menuActive");
      @include font_color("menuActiveText");
    }

    &:hover {
      @include background_color("menuActive");
      @include font_color("menuActiveText");
      color: $menuActiveText !important;
    }

    min-width: 130px !important;
    background-color: transparent !important;
    font-weight: 600;
    @include font_color("menuText");
    font-size: $sideBarFontSize;
  }
}

.hideSidebar {
  .sidebar-container {
    width: 54px !important;
  }

  .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;
    @include background("menuActive");
    @include font_color("menuText");

    &:hover {
      @include background("menuActive");
      opacity: .9;

      .svg-icon,
      i,
      span {
        color: $menuText;
      }
    }
  }

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

.el-submenu.is-active .el-submenu__title {
  @include background_color("submenuBg");
  @include font_color("submenuColor");
  border-right: 5px solid #36CEB6;
}

.el-submenu.is-active .el-submenu__title:hover {
  @include font_color("submenuColor");
}

.el-submenu.is-active .el-submenu__title .svg-icon {
  @include font_color("submenuColor");
}

.el-submenu__title {
  display: flex;
  align-items: center;
}

.sidebar-container .submenu-title-noDropdown>i,
.sidebar-container .el-submenu__title>i {
  color: #6D7278 !important;
}

.el-submenu.is-active .el-submenu__title>i {
  color: #FFFFFF !important;
}

.el-submenu__title span {
  white-space: normal;
  word-break: break-all;
  line-height: 20px;
  flex: 1;
  padding-right: 20px;
}

.el-menu-item {
  height: 42px;
  display: flex;
  align-items: center;
  padding-right: 20px !important;
}

.el-menu-item span {
  white-space: nowrap !important;
  word-break: break-all;
  line-height: 20px;
  flex: 1;
}