SubMenuItem.vue
2.17 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
<template>
<el-menu-item-group :title="parentTitle" class="scrm-base-submenu-item" 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: 'SubMenuItem',
props: {
parentTitle: {
type: String,
required: false,
default: ''
},
menuItems: {
type: Array,
required: true
}
},
methods: {
handleSelect({ path }) {
if (path) {
this.$router.push(path)
}
}
}
}
</script>
<style lang="scss" scoped>
@import '~@/assets/style/collapse.scss';
$active-background-color: rgba(88, 80, 255, 0.2) !important;
$menu-item-width: 176px !important;
.scrm-base-submenu-item {
/deep/.el-menu-item-group__title {
display: none;
}
/deep/ul {
display: flex;
flex-direction: column;
align-items: center;
.el-menu-item {
width: $menu-item-width;
min-width: $menu-item-width;
height: 40px;
line-height: 40px;
align-self: center;
border-radius: 4px;
span {
color: #666;
font-size: 16px;
}
&:hover,
&.is-active {
outline: 0 !important;
color: $main-color !important;
background-color: $active-background-color;
border-bottom: none;
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>