修改湖畔社区页面显示数据的逻辑
This commit is contained in:
parent
71332e070a
commit
e4a21804b0
@ -124,9 +124,9 @@ export default {
|
|||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 过滤出距离1km以内的数据
|
// 过滤出距离1km以内的数据,确保距离为0的值也能被正确保留
|
||||||
processedList = processedList.filter(item =>
|
processedList = processedList.filter(item =>
|
||||||
item.distanceValue && item.distanceValue <= 1
|
item.distanceValue !== undefined && item.distanceValue !== null && item.distanceValue <= 1
|
||||||
);
|
);
|
||||||
|
|
||||||
// 调用腾讯地图API获取附近1km的小区(包含图片信息)
|
// 调用腾讯地图API获取附近1km的小区(包含图片信息)
|
||||||
@ -179,10 +179,10 @@ export default {
|
|||||||
mergedList = uniqueByField(mergedList, 'community_id');
|
mergedList = uniqueByField(mergedList, 'community_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据距离排序
|
// 根据距离排序,确保距离为0的值也能正确排序
|
||||||
mergedList.sort((a, b) => {
|
mergedList.sort((a, b) => {
|
||||||
const distanceA = a.distanceValue || Infinity;
|
const distanceA = a.distanceValue !== undefined && a.distanceValue !== null ? a.distanceValue : Infinity;
|
||||||
const distanceB = b.distanceValue || Infinity;
|
const distanceB = b.distanceValue !== undefined && b.distanceValue !== null ? b.distanceValue : Infinity;
|
||||||
|
|
||||||
return distanceA - distanceB;
|
return distanceA - distanceB;
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user