微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决在 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 举报,一经查实,本站将立刻删除。