hanxu317317/city_pickers

数据源是否支持省市区children

Closed this issue · 2 comments

hjlxy commented

{
"id": 3,
"name": "安徽省",
"children": [
{
"id": 36,
"name": "安庆市",
"children": [
{
"id": 398,
"name": "迎江区"
},
{
"id": 399,
"name": "大观区"
},
{
"id": 400,
"name": "宜秀区"
},
{
"id": 401,
"name": "桐城市"
},
{
"id": 402,
"name": "怀宁县"
},
{
"id": 403,
"name": "枞阳县"
},
{
"id": 404,
"name": "潜山县"
},
{
"id": 405,
"name": "太湖县"
},
{
"id": 406,
"name": "宿松县"
},
{
"id": 407,
"name": "望江县"
},
{
"id": 408,
"name": "岳西县"
}
]
},
{
"id": 37,
"name": "蚌埠市",
"children": [
{
"id": 409,
"name": "中市区"
},
{
"id": 410,
"name": "东市区"
},
{
"id": 411,
"name": "西市区"
},
{
"id": 412,
"name": "郊区"
},
{
"id": 413,
"name": "怀远县"
},
{
"id": 414,
"name": "五河县"
},
{
"id": 415,
"name": "固镇县"
}
]
},
{
"id": 38,
"name": "巢湖市",
"children": [
{
"id": 416,
"name": "居巢区"
},
{
"id": 417,
"name": "庐江县"
},
{
"id": 418,
"name": "无为县"
},
{
"id": 419,
"name": "含山县"
},
{
"id": 420,
"name": "和县"
}
]
},
{
"id": 39,
"name": "池州市",
"children": [
{
"id": 421,
"name": "贵池区"
},
{
"id": 422,
"name": "东至县"
},
{
"id": 423,
"name": "石台县"
},
{
"id": 424,
"name": "青阳县"
}
]
},
{
"id": 40,
"name": "滁州市",
"children": [
{
"id": 425,
"name": "琅琊区"
},
{
"id": 426,
"name": "南谯区"
},
{
"id": 427,
"name": "天长市"
},
{
"id": 428,
"name": "明光市"
},
{
"id": 429,
"name": "来安县"
},
{
"id": 430,
"name": "全椒县"
},
{
"id": 431,
"name": "定远县"
},
{
"id": 432,
"name": "凤阳县"
}
]
},
{
"id": 41,
"name": "阜阳市",
"children": [
{
"id": 433,
"name": "蚌山区"
},
{
"id": 434,
"name": "龙子湖区"
},
{
"id": 435,
"name": "禹会区"
},
{
"id": 436,
"name": "淮上区"
},
{
"id": 437,
"name": "颍州区"
},
{
"id": 438,
"name": "颍东区"
},
{
"id": 439,
"name": "颍泉区"
},
{
"id": 440,
"name": "界首市"
},
{
"id": 441,
"name": "临泉县"
},
{
"id": 442,
"name": "太和县"
},
{
"id": 443,
"name": "阜南县"
},
{
"id": 444,
"name": "颖上县"
}
]
},
{
"id": 42,
"name": "淮北市",
"children": [
{
"id": 445,
"name": "相山区"
},
{
"id": 446,
"name": "杜集区"
},
{
"id": 447,
"name": "烈山区"
},
{
"id": 448,
"name": "濉溪县"
}
]
},
{
"id": 43,
"name": "淮南市",
"children": [
{
"id": 449,
"name": "田家庵区"
},
{
"id": 450,
"name": "大通区"
},
{
"id": 451,
"name": "谢家集区"
},
{
"id": 452,
"name": "八公山区"
},
{
"id": 453,
"name": "潘集区"
},
{
"id": 454,
"name": "凤台县"
}
]
},
{
"id": 44,
"name": "黄山市",
"children": [
{
"id": 455,
"name": "屯溪区"
},
{
"id": 456,
"name": "黄山区"
},
{
"id": 457,
"name": "徽州区"
},
{
"id": 458,
"name": "歙县"
},
{
"id": 459,
"name": "休宁县"
},
{
"id": 460,
"name": "黟县"
},
{
"id": 461,
"name": "祁门县"
}
]
},
{
"id": 45,
"name": "六安市",
"children": [
{
"id": 462,
"name": "金安区"
},
{
"id": 463,
"name": "裕安区"
},
{
"id": 464,
"name": "寿县"
},
{
"id": 465,
"name": "霍邱县"
},
{
"id": 466,
"name": "舒城县"
},
{
"id": 467,
"name": "金寨县"
},
{
"id": 468,
"name": "霍山县"
}
]
},
{
"id": 46,
"name": "马鞍山市",
"children": [
{
"id": 469,
"name": "雨山区"
},
{
"id": 470,
"name": "花山区"
},
{
"id": 471,
"name": "金家庄区"
},
{
"id": 472,
"name": "当涂县"
}
]
},
{
"id": 47,
"name": "宿州市",
"children": [
{
"id": 473,
"name": "埇桥区"
},
{
"id": 474,
"name": "砀山县"
},
{
"id": 475,
"name": "萧县"
},
{
"id": 476,
"name": "灵璧县"
},
{
"id": 477,
"name": "泗县"
}
]
},
{
"id": 48,
"name": "铜陵市",
"children": [
{
"id": 478,
"name": "铜官山区"
},
{
"id": 479,
"name": "狮子山区"
},
{
"id": 480,
"name": "郊区"
},
{
"id": 481,
"name": "铜陵县"
}
]
},
{
"id": 49,
"name": "芜湖市",
"children": [
{
"id": 482,
"name": "镜湖区"
},
{
"id": 483,
"name": "弋江区"
},
{
"id": 484,
"name": "鸠江区"
},
{
"id": 485,
"name": "三山区"
},
{
"id": 486,
"name": "芜湖县"
},
{
"id": 487,
"name": "繁昌县"
},
{
"id": 488,
"name": "南陵县"
}
]
},
{
"id": 50,
"name": "宣城市",
"children": [
{
"id": 489,
"name": "宣州区"
},
{
"id": 490,
"name": "宁国市"
},
{
"id": 491,
"name": "郎溪县"
},
{
"id": 492,
"name": "广德县"
},
{
"id": 493,
"name": "泾县"
},
{
"id": 494,
"name": "绩溪县"
},
{
"id": 495,
"name": "旌德县"
}
]
},
{
"id": 51,
"name": "亳州市",
"children": [
{
"id": 496,
"name": "涡阳县"
},
{
"id": 497,
"name": "蒙城县"
},
{
"id": 498,
"name": "利辛县"
},
{
"id": 499,
"name": "谯城区"
}
]
},
{
"id": 3401,
"name": "合肥市",
"children": [
{
"id": 3402,
"name": "庐阳区"
},
{
"id": 3403,
"name": "瑶海区"
},
{
"id": 3404,
"name": "蜀山区"
},
{
"id": 3405,
"name": "包河区"
},
{
"id": 3406,
"name": "长丰县"
},
{
"id": 3407,
"name": "肥东县"
},
{
"id": 3408,
"name": "肥西县"
}
]
}
]
}

其实二种数据源. 没什么本质上差别. 无非就是格式上的区别. 可以写一段代码. 把他转成组件需要的结构. 也就30行左右的代码.

hjlxy commented

好的,谢谢