8
8
</div >
9
9
<ul class =" menu-list" >
10
10
<li v-for =" (item, index) in menu" :key =" index" >
11
- <router-link :to =" item.path" :exact =" true" :aria-expanded = " isExpanded(item) ? 'true' : 'false' " v-if =" item.path" @click.native = " toggle(index, item) " >
11
+ <router-link :to =" item.path" :exact =" true" v-if =" item.path" >
12
12
<span class =" icon icon-left is-small" ><i :class =" ['fa', item.meta.icon]" ></i ></span >
13
13
{{ item.meta.label || item.name }}
14
- <span class =" icon is-small is-angle" v-if =" item.subroute && item.subroute.length" >
15
- <i class =" fa fa-angle-down" ></i >
16
- </span >
17
14
</router-link >
18
- <a :aria-expanded =" isExpanded(item)" v-else @click.native =" toggle(index, item)" >
19
- <span class =" icon icon-left is-small" ><i :class =" ['fa', item.meta.icon]" ></i ></span >
20
- {{ item.meta.label || item.name }}
21
- <span class =" icon is-small is-angle" v-if =" item.subroute && item.subroute.length" >
22
- <i class =" fa fa-angle-down" ></i >
23
- </span >
24
- </a >
25
-
26
- <expanding v-if =" item.subroute && item.subroute.length" >
27
- <ul v-show =" isExpanded(item)" class =" menu-list-expanded" >
28
- <li v-for =" (subItem, index) in item.subroute" v-if =" subItem.path" :key =" index" >
29
- <router-link :to =" subItem.path" >
30
- {{ subItem.meta && subItem.meta.label || subItem.name }}
31
- </router-link >
32
- </li >
33
- </ul >
34
- </expanding >
35
15
</li >
36
16
</ul >
37
17
</aside >
38
18
</template >
39
19
40
20
<script >
41
- import Expanding from ' vue-bulma-expanding'
42
- import { mapGetters , mapActions } from ' vuex'
21
+ import { mapGetters } from ' vuex'
43
22
44
23
export default {
45
- components: {
46
- Expanding
47
- },
48
-
49
24
props: {
50
25
show: Boolean
51
26
},
52
27
53
- data () {
54
- return {
55
- isReady: false
56
- }
57
- },
58
-
59
- mounted () {
60
- let route = this .$route
61
- if (route .name ) {
62
- this .isReady = true
63
- this .shouldExpandMatchItem (route)
64
- }
65
- },
66
-
67
28
computed: mapGetters ({
68
29
menu: ' menuitems'
69
- }),
70
-
71
- methods: {
72
- ... mapActions ([
73
- ' expandMenu'
74
- ]),
75
-
76
- isExpanded (item ) {
77
- return item .meta .expanded
78
- },
79
-
80
- toggle (index , item ) {
81
- this .expandMenu ({
82
- index: index,
83
- expanded: ! item .meta .expanded
84
- })
85
- },
86
-
87
- shouldExpandMatchItem (route ) {
88
- var parent
89
-
90
- const p = this .findParentFromMenu (route)
91
- if (p) {
92
- parent = p
93
- }
94
-
95
- if (parent && ' expanded' in parent .meta ) {
96
- this .expandMenu ({
97
- item: parent,
98
- expanded: true
99
- })
100
- }
101
- },
102
-
103
- findParentFromMenu (route ) {
104
- const menu = this .menu
105
- for (let i = 0 , l = menu .length ; i < l; i++ ) {
106
- const item = menu[i]
107
- const k = item .subroute && item .subroute .length
108
- if (k) {
109
- for (let j = 0 ; j < k; j++ ) {
110
- if (item .subroute [j].path === route .path ) {
111
- return item
112
- }
113
- }
114
- }
115
- }
116
- }
117
- },
118
-
119
- watch: {
120
- $route (route) {
121
- this .isReady = true
122
- this .shouldExpandMatchItem (route)
123
- }
124
- }
125
-
30
+ })
126
31
}
127
32
</script >
128
33
@@ -160,12 +65,6 @@ a.navbar-item:hover {
160
65
161
66
.icon {
162
67
vertical-align : baseline ;
163
- & .is-angle {
164
- position : absolute ;
165
- right : 10px ;
166
- margin-top : 13px ;
167
- transition : transform .377s ease ;
168
- }
169
68
}
170
69
171
70
.brand-top {
@@ -198,7 +97,6 @@ a.navbar-item:hover {
198
97
li a .is-active {
199
98
background-color : rgb (60 , 57 , 74 );
200
99
color : #51a0f6 ;
201
- font-weight : bold ;
202
100
border-right : 3px solid #51a0f6 ;
203
101
}
204
102
@@ -214,15 +112,9 @@ a.navbar-item:hover {
214
112
215
113
li a {
216
114
color : #8c91a0 ;
217
- width : 140 px ;
218
- margin-left : 60 px ;
115
+ width : 150 px ;
116
+ margin-left : 50 px ;
219
117
line-height : 40px ;
220
-
221
- & [aria-expanded = " true" ] {
222
- .is-angle {
223
- transform : rotate (180deg );
224
- }
225
- }
226
118
}
227
119
228
120
li a + ul {
0 commit comments