make node-views emit instead of calling the store
This commit is contained in:
@@ -191,11 +191,12 @@ export default {
|
|||||||
// BASIC HANDLERS
|
// BASIC HANDLERS
|
||||||
|
|
||||||
onNodeClick (nodeData) {
|
onNodeClick (nodeData) {
|
||||||
|
// FIXME CURRENT PROBLEM AS API TREATING TEXTPRODs as TEXTREFs (no `parents:`)
|
||||||
const { id, parents } = nodeData
|
const { id, parents } = nodeData
|
||||||
if (parents) {
|
if (parents) {
|
||||||
this.$emit('open', parents[0].id, id)
|
this.$emit('open-node', parents[0].id, id)
|
||||||
} else {
|
} else {
|
||||||
this.$emit('open', id)
|
this.$emit('open-node', id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -36,12 +36,12 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['activeNodes']),
|
...mapGetters(['activeNodes'])
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onOpen (childId) {
|
onOpen (childId) {
|
||||||
this.$store.dispatch('OPEN_NODE', [this.parentId, childId])
|
this.$emit('open-child', childId)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -71,8 +71,8 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
toCommaList,
|
toCommaList,
|
||||||
|
|
||||||
onOpen (nodeId) {
|
onOpen (siblingId) {
|
||||||
this.$store.dispatch('OPEN_NODE', [nodeId])
|
this.$parent.$emit('open-node', siblingId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export default {
|
|||||||
toCommaList,
|
toCommaList,
|
||||||
|
|
||||||
onClose () {
|
onClose () {
|
||||||
this.$store.dispatch('CLOSE_NODE', this.node.id)
|
this.$parent.$emit('close-node', this.node.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
<node-view-child-list v-if="mode === 'view'" :children="node.children" :parent-id="node.id" />
|
<node-view-child-list
|
||||||
|
v-if="mode === 'view'"
|
||||||
|
:children="node.children"
|
||||||
|
:parent-id="node.id"
|
||||||
|
@open-child="$parent.$emit('open-child', $event)"
|
||||||
|
/>
|
||||||
<button-close v-if="mode === 'view'" @click="onClose()" />
|
<button-close v-if="mode === 'view'" @click="onClose()" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -42,7 +47,7 @@ export default {
|
|||||||
toCommaList,
|
toCommaList,
|
||||||
|
|
||||||
onClose () {
|
onClose () {
|
||||||
this.$store.dispatch('CLOSE_NODE', this.node.id)
|
this.$parent.$emit('close-node', this.node.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
v-for="parent in parents" :key="parent.id"
|
v-for="parent in parents" :key="parent.id"
|
||||||
:node="parent"
|
:node="parent"
|
||||||
mode="card"
|
mode="card"
|
||||||
|
@open-node="$emit('open-node', $event)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user