Appearance
连接验证
¥Connection Validation
要在创建连接之前验证连接,你可以将函数传递给 <Handle />
组件的 is-valid-connection
属性,也可以使用 <VueFlow />
组件的 onConnect
事件。
¥To validate connections before they are created you can either pass a function to the is-valid-connection
prop of the <Handle />
component or use the onConnect
event of the <VueFlow />
component.
另一种方法是将 isValidConnection
函数传递给 <VueFlow />
组件的 is-valid-connection
属性。此功能将应用于流中的所有连接(包括现有连接)。
¥Another alternative is to pass a isValidConnection
function to the is-valid-connection
prop of the <VueFlow />
component. This function will be applied to all connections in the flow (even existing ones).
在自定义节点中使用句柄
¥Using a handle in a custom node
vue
<script setup>
import { Handle, Position } from '@vue-flow/core'
</script>
<template>
<Handle type="source" :position="Position.Right" />
<Handle type="target" :position="Position.Left" />
</template>