How to add new nodes in a custom pinia store #1148
-
Hi! First I want to thank you for this amazing library! :) Currently I use this function 'addNode' to add extra nodes on my page flow.vue flow.vue
my store divisions.js
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Instead of using const addNode = () => {
const newNode = {
type: 'custom',
id: currentNode,
label: divisionData.name,
position: { x: 200, y: 100 },
}
divisions.push(newNode)
divisions.push({
source: previousNode,
target: currentNode,
type: 'step',
sourceHandle: 'b',
targetHandle: 'a',
})
} They will then be passed down to Vue Flow via the v-model you're using. |
Beta Was this translation helpful? Give feedback.
Instead of using
addNodes
oraddEdges
simply push the new nodes / edges into your state.They will then be passed down to Vue Flow via the v-model you're using.
You don't need to use these helper functions to add nodes or edges.