Skip to content

连接验证

🌐 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>

VueFlow 中文网 - 粤ICP备13048890号