LeftSideMenuLv3.vue 2.11 KB
<template>
  <el-menu-item-group class="com-left-side-menu-lv3" v-if="menuItems">
    <el-menu-item v-for="item in menuItems.noHidden()" :key="item.id" :index="item.id" @click.native.stop="handleSelect(item)">
      <span>{{ item.title }}</span>
    </el-menu-item>
  </el-menu-item-group>
</template>

<script>
export default {
  name: 'LeftSideMenuLv3',
  inject: ['bus'],
  props: {
    menuItems: {
      type: Array,
      required: true
    }
  },
  methods: {
    handleSelect({ path, children = [] }) {
      if (path) {
        this.$router.push(path)
        this.bus.$emit('menu3Changed', children.noHidden())
      }
    }
  }
}
</script>
<style lang="scss" scoped>
@import '~@/assets/style/collapse.scss';
@import '~@/assets/style/mixins.scss';
$menu-item-width: 144px !important;
.com-left-side-menu-lv3 {
  width: $menu-item-width;
  /deep/.el-menu-item-group__title {
    display: none;
  }
  /deep/ul {
    display: flex;
    flex-direction: column;
    align-items: center;
    .el-menu-item {
      width: 100% !important;
      min-width: 100% !important;
      height: 32px;
      line-height: 32px;
      align-self: center;
      border-radius: 4px;
      // padding-left: 0 !important;
      padding: 0 8px !important;
      span {
        color: #777;
        font-size: 14px;
      }
      &:hover,
      &.is-active {
        @include menu-highlight;
        span {
          color: $main-color !important;
        }
      }
      &:hover:not(.is-active) {
        background-color: transparent !important;
      }
    }
  }
}
</style>
<style lang="scss">
$width: 150px;
@mixin popup_width {
  width: $width !important;
  min-width: $width !important;
}
.el-menu--vertical {
  &.el-submenu-popper-base {
    .el-menu--popup {
      @include popup_width;
      margin-left: -8px;
      box-shadow: 0px 6px 20px 0px rgba(122, 122, 122, 0.2);
      border-radius: 4px;
      .scrm-base-submenu-item {
        .el-menu-item {
          @include popup_width;
          padding-left: 20px !important;
          border-radius: 0;
        }
        .el-menu-item-group__title {
          display: block;
        }
      }
    }
  }
}
</style>