Skip to content

Adding nodes and edges using pinia store #850

Closed Answered by danielkhendricks
danielkhendricks asked this question in Q&A
Discussion options

You must be logged in to vote

Instead of using v-model to bind both nodes and edges to the same array in Vue Flow, I decided to separate them into separate arrays. This helped to resolve the issue I was facing. Now, I am using v-model to bind only nodes to the nodes array and v-bind to bind edges to the edges array.

Example:

  <VueFlow
    :nodes="flowchart.nodes"
    :edges="flowchart.edges"
    :node-types="nodeTypes"
  >

Now in a separate store I can do:

flowchart.nodes.push(node)
flowchart.edges.push(edge)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by danielkhendricks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant