Menu.vue
3.02 KB
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<template>
<div class="Navs">
<el-menu
:default-active="activeMenu"
class="el-menu-vertical-demo"
:collapse="true"
router
>
<el-menu-item index="/homePage">
<i><img src="@/assets/images/meun/首页.png" alt="" /></i>
<span>首页</span>
<!-- <span slot="title">首页</span> -->
</el-menu-item>
<div v-for="v in navList" :key="v.id">
<template v-if="v.children && v.children.length">
<el-submenu :index="v.path">
<template slot="title">
<i>
<img :src="require(`@/assets/images/meun/${v.fullName}.png`)" alt="photo.text" />
</i>
<span slot="title">{{ v.fullName }}</span>
</template>
<el-menu-item-group>
<el-menu-item
:index="item.path"
v-for="item in v.children"
:key="item.id"
>{{ item.fullName }}</el-menu-item
>
</el-menu-item-group>
</el-submenu>
</template>
<template v-else>
<el-menu-item :index="v.path">
<i class="el-icon-menu"></i>
<span>{{ v.fullName }}</span>
</el-menu-item>
</template>
</div>
</el-menu>
</div>
</template>
<script>
export default {
name: "Navs",
data() {
return {
navList: "",
};
},
mounted() {
// 显示"内部系统PC权限"下的页面
let meun = this.$store.state.user.menuList.find(
(v) => v.id == "582459649622541573"
).children;
this.navList = meun;
},
computed: {
// 默认激活的菜单
activeMenu() {
return this.$route.path;
},
},
methods: {
},
};
</script>
<style scoped lang="scss">
.Navs {
.el-menu-vertical-demo:not(.el-menu--collapse) {
width: 200px;
min-height: 400px;
}
:deep(.el-menu--collapse) {
width: 100%;
}
.el-menu-item {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
line-height: 30px;
color: #fff;
padding: 40px 0px !important;
&.is-active {
color: #409EFF;
background-color: #dfdada34;
}
span {
height: 30px;
width: 100%;
overflow: unset;
visibility: unset;
}
&:hover {
background-color: #dfdada56;
}
}
:deep(.el-menu) {
background-color: transparent;
border-right: unset;
.el-submenu__title {
display: flex;
flex-direction: column;
align-items: center;
line-height: 30px;
justify-content: center;
color: #fff;
padding: 40px 0px !important;
&:hover {
background-color: #dfdada56;
}
}
i {
color: #fff;
font-size: 30px;
width: 30px;
height: 30px;
margin: 0;
img {
width: 100%;
height: 100%;
}
}
.el-submenu__icon-arrow.el-icon-arrow-right {
display: none;
}
}
}
.el-menu-item-group {
:deep(.el-menu-item-group__title) {
display: none;
}
}
</style>