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
<template>
<el-menu
:default-active="$route.path"
:router="true"
:unique-opened="true"
text-color="#fff"
background-color="#333333"
active-text-color="#ffd04b"
:collapse="menuType"
class="el-menu-vertical-demo">
<div class="menu-btn" @click="menuType = !menuType">
<i v-if="!menuType" class="iconfont icon-shouqi"></i>
<i v-if="menuType" class="iconfont icon-zhankai"></i>
</div>
<el-submenu v-for="(data,index) in menuList" :index="data.value" :key="index">
<template slot="title">
<i :class="'iconfont menu-icon '+data.icon"></i>
<span>{{data.value}}</span>
</template>
<template v-for="(item,i) in data.list">
<el-menu-item
v-if="!item.hidden" class="item"
:index="item.path" :key="i">{{item.value}}</el-menu-item>
</template>
</el-submenu>
</el-menu>
</template>
<script>
export default {
name: "leftMenu",
data() {
return {
menuList: this.$store.state.menuList,
menuType: false
};
},
mounted() {
// console.log(this.menuList);
},
methods: {
changeMenuType: function() {
this.$store.state.menuType = !this.$store.state.menuType;
},
toPath: function(data) {
this.$router.push({ name: data.routerName });
if (this.$store.state.openedTab.indexOf(data) < 0) {
this.$store.state.openedTab.push(data);
}
}
}
};
</script>
<style scoped lang="less">
@import "../../util/public";
.el-menu-vertical-demo:not(.el-menu--collapse) {
width: 200px;
}
.el-menu {
background: @bg-b;
color: white;
overflow: auto;
height: 100%;
.menu-btn {
height: 35px;
background: @bg-b-s;
line-height: 35px;
/*text-align: center;*/
i {
font-size: 26px;
float: right;
padding: 0 15px;
}
}
.el-submenu {
.menu-icon {
color: white;
font-size: 18px;
position: relative;
right: 5px;
}
.el-menu-item {
background: @main-font-color;
}
.template {
color: black;
}
}
}
</style>