amis
amis copied to clipboard
Tree控件勾选判断条件的bug,当children=[]时逻辑有误勾选不上
https://github.com/baidu/amis/blob/e34df2c938f218569d7720c75b60015ff71902ff/src/components/Tree.tsx#L293
此处判断有问题,child.children&&child.children.length
具体场景可以描述一下么,请附上配置schema和复现步骤
看我截图,就是当后台返回children=[]时,判断分支走不进去,勾不上

{
"type": "page",
"body": {
"type": "form",
"debug": true,
"api": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/form/saveForm",
"body": [
{
"type": "input-tree",
"name": "tree1",
"label": "只包含子节点的值",
"multiple": true,
"onlyChildren": true,
"options": [
{
"label": "A",
"value": "a",
"children": []
},
{
"label": "B",
"value": "b",
"children": [
{
"label": "B-1",
"value": "b-1",
"children": []
},
{
"label": "B-2",
"value": "b-2",
"children": []
},
{
"label": "B-3",
"value": "b-3",
"children": []
}
]
},
{
"label": "C",
"value": "c",
"children": []
}
]
}
]
}
}

就是叶节点 "children": [] 的情况下,勾父节点那段代码判断有问题,无法勾中,正好我碰到服务端接口没数据返回的不是null。。。