How Can I get All Nodes' refs(instance)? #1518
-
i can use ref to get instance in slot,like
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
and i see useNode provide 'nodeEl' property, but use 'nodeEl.__vnode' seems not concise |
Beta Was this translation helpful? Give feedback.
-
Not sure what this is supposed to mean. The
You can wrap your custom node in a render function and add a ref from there. const nodeTypes = {
custom: (nodeProps) => h(MyNode, { ...nodeProps, ref: myRef })
} Although I'd think working with a store or composable + provide/inject would be more elegant than storing refs to all nodes and then triggering functions from there but ultimately that's your choice to make ^^ |
Beta Was this translation helpful? Give feedback.
-
i tried
it seems that i can get the newest node instance' ref.but if there are many nodes in graph, it's not work |
Beta Was this translation helpful? Give feedback.
You can store refs in an array or a map.