How Can I Emits Event From Nodes With Props 'node-types' #1432
-
i got many custom nodes, and when i use 'node-types' to render my nodes, it seems i have no way to emits my events from my nodes;
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
You can wrap custom nodes in the nodeTypes object as a function and pass additional props that way: const nodeTypes = {
selectorNode: (props: NodeProps) => h(ColorSelectorNode, { ...props, onFoo: () => console.log('foo') }),
} <script lang="ts" setup>
import type { NodeProps } from '@vue-flow/core'
const props = defineProps<NodeProps>()
const emits = defineEmits(['foo'])
</script>
<template>
<button @click="emits('foo')">foo</button>
</template> |
Beta Was this translation helpful? Give feedback.
You can wrap custom nodes in the nodeTypes object as a function and pass additional props that way: