File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
packages/@vuepress/theme-default/components Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 7
7
<SidebarGroup
8
8
v-if =" item.type === 'group'"
9
9
:item =" item"
10
- :open =" i === openGroupIndex "
10
+ :open =" openGroupIndices.has(i) "
11
11
:collapsable =" item.collapsable || item.collapsible"
12
12
:depth =" depth"
13
13
@toggle =" toggleGroup(i)"
@@ -39,7 +39,7 @@ export default {
39
39
40
40
data () {
41
41
return {
42
- openGroupIndex : 0
42
+ openGroupIndices : new Set ([ 0 ])
43
43
}
44
44
},
45
45
@@ -60,12 +60,20 @@ export default {
60
60
this .items
61
61
)
62
62
if (index > - 1 ) {
63
- this .openGroupIndex = index
63
+ this .openGroupIndices = new Set ([ index])
64
64
}
65
65
},
66
66
67
67
toggleGroup (index ) {
68
- this .openGroupIndex = index === this .openGroupIndex ? - 1 : index
68
+ if (this .openGroupIndices .has (index)) {
69
+ this .openGroupIndices .delete (index)
70
+ } else {
71
+ this .openGroupIndices .add (index)
72
+ }
73
+
74
+ // a change to the set data structure does not trigger a UI update,
75
+ // so force a repaint of the UI
76
+ this .$forceUpdate ()
69
77
},
70
78
71
79
isActive (page ) {
You can’t perform that action at this time.
0 commit comments