-
+
@@ -47,17 +47,24 @@ export default {
},
methods: {
- openText (parent, id) {
- if (parent.children.includes(id)) return
- parent.children.push(id)
+ openText (id, childId) {
+ const parent = this.parents.find(p => p.id === id)
+ if (parent && (childId === undefined || parent.children.includes(childId))) return
+
+ if (!parent) {
+ this.parents.push({ id, children: childId ? [childId] : [] })
+ } else if (childId) {
+ parent.children.push(childId)
+ }
this.updateQuery(this.parents)
},
- closeText (parent, id) {
- if (!id) {
+ closeText (id, childId) {
+ const parent = this.parents.find(p => p.id === id)
+ if (!childId) {
this.updateQuery(this.parents.filter(p => p !== parent))
} else {
- parent.children = parent.children.filter(id_ => id_ !== id)
+ parent.children = parent.children.filter(childId_ => childId_ !== childId)
this.updateQuery(this.parents)
}
},
diff --git a/src/pages/library/TreeMap.vue b/src/pages/library/TreeMap.vue
index a4923f1..4154212 100644
--- a/src/pages/library/TreeMap.vue
+++ b/src/pages/library/TreeMap.vue
@@ -4,6 +4,7 @@
v-if="!loading"
v-bind="mapData"
:show-id="true"
+ v-on="$listeners"
/>