3
Picker如何实现深度不一直的tree结构绑定?目前我有个这样的tree,
[
{
"id": "5efc872c-cfdf-afe4-0009-644a65755b37",
"text": "中心",
"children": [
{
"id": "8efc872c-cfdf-afe4-0009-644b68be3d90",
"text": "1区",
"children": [
{
"id": "3efc872c-cfdf-afe4-0009-645c5fba9935",
"text": "1-1区",
"children": [
{
"id": "2efc872f-cfdf-afe4-0009-7cfe2781afdc",
"text": "1-1-1区"
},
{
"id": "9efc872f-cfdf-afe4-0009-7cfe2781afdc",
"text": "1-1-2区",
"children": [
{
"id": "5f75a58a-4e88-a940-007c-60ff581b7164",
"text": "1-1-2-1组"
},
{
"id": "5f75a58a-4e88-a940-007c-61013f954245",
"text": "1-1-2-2组"
},
{
"id": "5f75a58a-4e88-a940-007c-610523c4f322",
"text": "1-1-2-3组"
}
]
}
]
}
]
},
{
"id": "5efc8730-cfdf-afe4-0009-82d65b21386f",
"text": "2区",
"children": [
{
"id": "5efc8730-cfdf-afe4-0009-82df2e3a279c",
"text": "2-1区"
},
{
"id": "5efc8730-cfdf-afe4-0009-82df2e3a279c",
"text": "2-2区"
}
]
},
{
"id": "5efc8730-cfdf-afe4-0009-82d815ec979d",
"text": "3区"
}
]
}
]
如上json,选择1-1-2的时候,后面的childre就不加载了
将1-1-2放在前面就可以
"id": "3efc872c-cfdf-afe4-0009-645c5fba9935",
"text": "1-1区",
"children": [
{
"id": "9efc872f-cfdf-afe4-0009-7cfe2781afdc",
"text": "1-1-2区",
"children": [
{
"id": "5f75a58a-4e88-a940-007c-60ff581b7164",
"text": "1-1-2-1组"
},
{
"id": "5f75a58a-4e88-a940-007c-61013f954245",
"text": "1-1-2-2组"
},
{
"id": "5f75a58a-4e88-a940-007c-610523c4f322",
"text": "1-1-2-3组"
}
]
},
{
"id": "2efc872f-cfdf-afe4-0009-7cfe2781afdc",
"text": "1-1-1区"
}
然后选择其他深度没有1-1-2长的数据时,会有bug,如下图