baidu / amis

前端低代码框架,通过 JSON 配置就能生成各种页面。
https://baidu.github.io/amis/
Apache License 2.0
17.33k stars 2.51k forks source link

[bug]InputTree 组件,设置addControls后,新增事件产生的数据缺少parent信息 #9932

Open yanshuanghua opened 7 months ago

yanshuanghua commented 7 months ago

描述问题:

InputTree 组件,设置addControls后,通过监听新增事件产生的数据缺少parent信息

截图或视频:

文档中示例是有parent信息的:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/input-tree#addconfirm image

如何复现(请务必完整填写下面内容):

  1. 你是如何使用 amis 的? sdk

  2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在 最新版6.3.0

  3. 粘贴有问题的完整 amis schema 代码: image 增加addControls后,缺少parent信息,代码见下:

    {
    "type": "page",
    "body": {
    "type": "form",
    "api": "/amis/api/mock2/form/saveForm",
    "debug": true,
    "body": [
      {
        "type": "input-tree",
        "name": "tree",
        "label": "Tree",
        "creatable": true,
        "removable": true,
        "editable": true,
        "addApi": "/amis/api/mock2/form/saveForm",
        "addControls": [
          {
            "type": "text",
            "name": "label",
            "label": "选项标题"
          },
          {
            "type": "text",
            "name": "value",
            "label": "选项值"
          }
        ],
        "onEvent": {
          "addConfirm": {
            "actions": [
              {
                "actionType": "toast",
                "args": {
                  "msg": "${event.data.item|json}"
                }
              }
            ]
          }
        },
        "options": [
          {
            "label": "Folder A",
            "value": 1,
            "children": [
              {
                "label": "file A",
                "value": 2
              },
              {
                "label": "file B",
                "value": 3
              }
            ]
          },
          {
            "label": "file C",
            "value": 4
          },
          {
            "label": "file D",
            "value": 5
          }
        ]
      }
    ]
    }
    }
  4. 操作步骤 请简单描述一下复现的操作步骤...

yanshuanghua commented 7 months ago

增加子节点时需要拿到父节点信息

github-actions[bot] commented 7 months ago

👍 Thanks for this! 🏷 I have applied any labels matching special text in your issue.

Please review the labels and make any necessary changes.

yanshuanghua commented 6 months ago

@2betop @nwind