0

我想从图中获取 Last 节点。如何实现?

反应流

我使用React Flow创建节点,使用Degre NPM 计算节点的位置

整个节点和边都来自 api。

看起来像这样

[
  {
    "id": "image-djf",
    "data": {
      "label": "image-djf",
      "disabled": false
    },
    "type": "customNode",
    "position": {
      "x": 362.50081845775696,
      "y": 25
    },
    "targetPosition": "right",
    "sourcePosition": "right"
  },
  {
    "source": "file-orp",
    "sourceHandle": null,
    "target": "image-djf",
    "targetHandle": null,
    "id": "reactflow__edge-text-file-orp-image-djf",
    "data": {},
    "type": "customNode",
    "position": {
      "x": 0,
      "y": 0
    }
  },
  {
    "source": "image-djf",
    "sourceHandle": null,
    "target": "colors-qws",
    "targetHandle": null,
    "id": "reactflow__edge-text-image-djf-colors-qws",
    "data": {},
    "type": "customNode",
    "position": {
      "x": 0,
      "y": 0
    }
  },
  {
    "id": "file-orp",
    "data": {
      "label": "file-orp",
      "disabled": false
    },
    "type": "customNode",
    "position": {
      "x": 62.50033248726362,
      "y": 100
    },
    "targetPosition": "right",
    "sourcePosition": "right"
  },
  {
    "source": "file-orp",
    "sourceHandle": null,
    "target": "text-fge",
    "targetHandle": null,
    "id": "reactflow__edge-text-file-orp-text-fge",
    "data": {},
    "type": "customNode",
    "position": {
      "x": 0,
      "y": 0
    }
  },
  {
    "id": "text-fge",
    "data": {
      "label": "text-fge",
      "disabled": false
    },
    "type": "customNode",
    "position": {
      "x": 362.5008109141938,
      "y": 175
    },
    "targetPosition": "right",
    "sourcePosition": "right"
  },
  {
    "source": "text-fge",
    "sourceHandle": null,
    "target": "summaries-wss",
    "targetHandle": null,
    "id": "reactflow__edge-text-text-fge-summaries-wss",
    "data": {},
    "type": "customNode",
    "position": {
      "x": 0,
      "y": 0
    }
  },
  {
    "id": "summaries-wss",
    "data": {
      "label": "summaries-wss",
      "disabled": false
    },
    "type": "customNode",
    "position": {
      "x": 662.5005293834345,
      "y": 175
    },
    "targetPosition": "right",
    "sourcePosition": "right"
  },
  {
    "id": "colors-qws",
    "data": {
      "label": "colors-qws",
      "disabled": false
    },
    "type": "customNode",
    "position": {
      "x": 662.5004337710324,
      "y": 25
    },
    "targetPosition": "right",
    "sourcePosition": "right"
  }
]

任何形式的帮助都会很受欢迎

4

0 回答 0