convertToTableData(data) {
const tableData = [];
if (data && Array.isArray(data)) {
// 遍历县
data.forEach(county => {
const countyName = county.areaname;
if (county.children && Array.isArray(county.children)) {
// 遍历街
county.children.forEach(street => {
const streetName = street.areaname;
if (street.children && Array.isArray(street.children)) {
// 遍历社区
street.children.forEach(community => {
const communityName = community.areaname;
// 将当前区域信息转为对象并添加到数组中
tableData.push({
xian: countyName,
jiedao: streetName,
shequ: communityName
});
});
}
});
}
});
}
return tableData;
},
10-21
1万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
02-05
1080
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-05
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交