getConnectedEdges()
此工具将过滤给定的边数组,以保留仅源节点或目标节点位于给定节点数组中的边。
import { getConnectedEdges } from '@xyflow/react';
 
const nodes = [
  { id: 'a', position: { x: 0, y: 0 } },
  { id: 'b', position: { x: 100, y: 0 } },
];
const edges = [
  { id: 'a->c', source: 'a', target: 'c' },
  { id: 'c->d', source: 'c', target: 'd' }
];
 
const connectedEdges = getConnectedEdges(nodes, edges);
// => [{ id: 'a->c', source: 'a', target: 'c' }]签名
| 名称 | 类型 | 
|---|---|
| #参数 |  | 
| # nodes | Node[] | 
| # edges | Edge[] | 
| #返回值 |  | 
| Edge[] |