fuliqi
2024-01-24 29c1e7eb5ac16e90d8991a86c1c071bc312ec8d9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!--
 * @Author: 黄攀
 * @Date: 2022-07-07 15:15:36
 * @Description:
-->
<template>
  <div class="sidebar">
    <el-menu :default-active="defaultActive" class="el-menu-vertical-demo" :router="true"
             unique-opened>
      <navMenu :navMenus="subMenuList"></navMenu>
    </el-menu>
  </div>
</template>
<script>
import navMenu from '@/components/navMenu/index.vue'
// import iconArr from '@/utils/constant/iconArr'
export default {
  props: {
    subMenuList: {
      type: Array,
      default() {
        return []
      }
    }
  },
  components: {
    navMenu
  },
  computed: {
    defaultActive() {
      return this.$route.meta.menuPath || this.$route.path
    }
  },
  // created() {
  //   this.setMenuIcon();
  // },
  methods: {
    // setMenuIcon() {
    //   if (this.subMenuList && this.subMenuList.length > 0) {
    //     this.subMenuList.forEach((v1) => {
    //       let _obj = iconArr.find((v2) => v2.path === v1.url);
    //       if (_obj) {
    //         Object.assign(v1, _obj)
    //       }
    //     })
    //   }
    // }
  }
}
</script>
<style  lang="scss" scoped>
$color: #333333;
.sidebar {
  /deep/ .el-menu {
    background: transparent;
    border-right: none;
    .el-menu-item,
    .hasChildrenMenu.el-submenu .el-submenu__title {
      color: rgba(255, 255, 255, 0.65);
      height: 60px;
      line-height: 60px;
    }
    .el-menu-item.noChildrenMenu,
    .hasChildrenMenu.el-submenu .el-submenu__title {
      border-left: 6px solid transparent;
    }
    .el-menu-item:hover,
    .hasChildrenMenu.el-submenu .el-submenu__title:hover {
      background-color: $color;
    }
    .el-menu-item:focus {
      background: transparent;
    }
    .hasChildrenMenu.el-submenu.is-active .el-menu-item.is-active {
      background-color: #c2a16c !important;
      border-left: 6px solid #c2a16c !important;
    }
    .hasChildrenMenu.is-active > .el-submenu__title,
    .noChildrenMenu.is-active {
      color: white;
      background: #333333;
      border-left: 6px solid #d0261e;
    }
    .hasChildrenMenu.is-active > .el-submenu__title i {
      color: white;
    }
    .iconfont{
      font-size:20px;
    }
  }
}
</style>