LeftSideMenuLv3.vue 1.52 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: #666;
        font-size: 14px;
      }
      &:hover,
      &.is-active {
        @include menu-highlight;
        span {
          color: $main-color !important;
        }
      }
      &:hover:not(.is-active) {
        background-color: transparent !important;
      }
    }
  }
}
</style>