描述问题:
InputTree 组件,设置addControls后,通过监听新增事件产生的数据缺少parent信息
截图或视频:
文档中示例是有parent信息的:https://aisuda.bce.baidu.com/amis/zh-CN/components/form/input-tree#addconfirm
如何复现(请务必完整填写下面内容):
- 你是如何使用 amis 的?
sdk
- amis 版本是什么?请先在最新 beta 版本测试问题是否存在
最新版6.3.0 - 粘贴有问题的完整
amis schema
代码:
增加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
}
]
}
]
}
}
- 操作步骤
请简单描述一下复现的操作步骤...
3条答案
按热度按时间xxb16uws1#
增加子节点时需要拿到父节点信息
vojdkbi02#
👍 Thanks for this!
🏷 I have applied any labels matching special text in your issue.
Please review the labels and make any necessary changes.
agxfikkp3#
@2betop@nwind