在 React-Flow 库中,我们可以只获取 Leaf 节点吗?

问题描述

我想从图中获取最后一个节点。这是如何实现的?

React Flow

我使用 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": {},"position": {
      "x": 0,"y": 0
    }
  },{
    "source": "image-djf","target": "colors-qws","id": "reactflow__edge-text-image-djf-colors-qws",{
    "id": "file-orp","data": {
      "label": "file-orp","position": {
      "x": 62.50033248726362,"y": 100
    },"target": "text-fge","id": "reactflow__edge-text-file-orp-text-fge",{
    "id": "text-fge","data": {
      "label": "text-fge","position": {
      "x": 362.5008109141938,"y": 175
    },{
    "source": "text-fge","target": "summaries-wss","id": "reactflow__edge-text-text-fge-summaries-wss",{
    "id": "summaries-wss","data": {
      "label": "summaries-wss","position": {
      "x": 662.5005293834345,{
    "id": "colors-qws","data": {
      "label": "colors-qws","position": {
      "x": 662.5004337710324,"sourcePosition": "right"
  }
]

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

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)