How to customize the internal parameter of nodes? #727
-
Thank you for your greart work. This library is very helpful. I want to pass the argument or state into custom node as internal parameters. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
If I understand you correctly, you want to pass some additional info to your nodes. {
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 // CustomNode.vue
<script setup>
const { node } = useNode()
console.log(node)
</script> Or, maybe you want to access the node from some Sidebar component // Sidebar.vue
<script setup>
const { findNode } = useVueFlow()
const node = findNode(someId)
console.log(node)
</script> |
Beta Was this translation helpful? Give feedback.
If I understand you correctly, you want to pass some additional info to your nodes.
You can use
node.data
for this purposeAccessing the values can be done multiple ways, really depends from where you want to access it.
From inside a custom node via props
Or from inside a custom node using
useNode
Or, maybe you want to access the node from some Sidebar component