Skip to content

How to customize the internal parameter of nodes? #727

Answered by bcakmakoglu
FreshLucas-git asked this question in Q&A
Discussion options

You must be logged in to vote

If I understand you correctly, you want to pass some additional info to your nodes.
You can use node.data for this purpose

{
   id: '1',
   label: 'Node 1',
   position: { x: 0, y: 0 },
   data: {
      additionalInfo: 'foobar'
   }
}

Accessing the values can be done multiple ways, really depends from where you want to access it.

From inside a custom node via props

// CustomNode.vue
<script setup>
const props = defineProps(['id', 'type', 'label', 'data'])

console.log(props)
</script>

Or from inside a custom node using useNode

// CustomNode.vue
<script setup>
const { node } = useNode()

console.log(node)
</script>

Or, maybe you want to access the node from some Sidebar component

// Sideba…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@FreshLucas-git
Comment options

Answer selected by FreshLucas-git
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