Skip to content

saving custom data #1156

Answered by bcakmakoglu
Randommist asked this question in Q&A
Nov 3, 2023 · 1 comments · 6 replies
Discussion options

You must be logged in to vote

Strange errors, they don't appear in my IDE.

Well, there's another way that possibly even more simple.

Inside of your custom node, you can call useNode to get the current node obj from the state and then just mutate the data object however you like.

For example:

<!-- Inside of a custom node component, like UserActionNode.vue -->
<script lang="ts" setup>
const { node } = useNode()

function onChange() {
  node.data = {
    ...node.data,
    hello: 'world',
  }
}
</script>

<template>
	<div>{{ node.data.hello }}</div>
</template>

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@Randommist
Comment options

@bcakmakoglu
Comment options

@Randommist
Comment options

@bcakmakoglu
Comment options

Answer selected by Randommist
@Randommist
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants