update node opening/closing

This commit is contained in:
axolotle
2021-06-22 16:16:25 +02:00
parent 5d8cd184dc
commit 5ab6e19cde
7 changed files with 32 additions and 16 deletions
+4 -4
View File
@@ -74,12 +74,12 @@ export default {
}
},
openNode (parentId, childId) {
this.$store.dispatch('OPEN_NODE', [parentId, childId])
openNode (ids) {
this.$store.dispatch('OPEN_NODE', ids)
},
closeNode (parentId, childId) {
this.$store.dispatch('CLOSE_NODE', [parentId, childId])
closeNode (ids) {
this.$store.dispatch('CLOSE_NODE', ids)
}
},
+5 -2
View File
@@ -58,8 +58,11 @@ export default {
methods: {
onOpen (node) {
// FIXME ALSO CHECK IF PARENT
this.$emit('open-node', node.id)
if (node.parents) {
this.$emit('open-node', { parentId: node.parents[0].id, childId: node.id })
} else {
this.$emit('open-node', { parentId: node.id })
}
}
},
+9 -1
View File
@@ -106,7 +106,15 @@ export default {
methods: {
toCommaList,
trim
trim,
onNodeClick (node) {
if (node.parents) {
this.$emit('open-node', { parentId: node.parents[0].id, childId: node.id })
} else {
this.$emit('open-node', { parentId: node.id })
}
}
},
created () {