前言
客户端开发,选择地址的功能很常见,全国城市数据网上有很多,但有城市拼音首字母的很少;
需求一:选择地址目录边缘有一竖排,A到Z的大写字母,这个首字母,就是城市拼音首字母,我们手指触摸,会带动列表滚动;
需求二:根据拼音首字母,将城市分类显示;
示例:
[{"name": "北京市","code": "110000","city": [{"name": "市辖区","code": "110100","area": [{"name": "东城区","code": "110101","firstP": "D"},{"name": "西城区","code": "110102","firstP": "X"},{"name": "朝阳区","code": "110105","firstP": "C"},{"name": "丰台区","code": "110106","firstP": "F"},{"name": "石景山区","code": "110107","firstP": "S"},{"name": "海淀区","code": "110108","firstP": "H"},{"name": "门头沟区","code": "110109","firstP": "M"},{"name": "房山区","code": "110111","firstP": "F"},{"name": "通州区","code": "110112","firstP": "T"},{"name": "顺义区","code": "110113","firstP": "S"},{"name": "昌平区","code": "110114","firstP": "C"},{"name": "大兴区","code": "110115","firstP": "D"},{"name": "怀柔区","code": "110116","firstP": "H"},{"name": "平谷区","code": "110117","firstP": "P"},{"name": "密云区","code": "110118","firstP": "M"},{"name": "延庆区","code": "110119","firstP": "Y"}],"firstP": "S"}],"firstP": "B"}/// 更多城市信息
... ... ]
下载链接
数据太多了
链接: 百度网盘
提取码: 1234
参考文档
这是没有带拼音首字母的全国城市划分数据。
全国行政区划数据 - JSON_全国地图省市数据json-CSDN博客