From e4a21804b0a7657bc36ff393a4896b026244ff49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E6=AF=85?= <1335909236@qq.com> Date: Fri, 17 Oct 2025 09:18:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B9=96=E7=95=94=E7=A4=BE?= =?UTF-8?q?=E5=8C=BA=E9=A1=B5=E9=9D=A2=E6=98=BE=E7=A4=BA=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/community/list/index.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/community/list/index.vue b/packages/community/list/index.vue index 8ec6d88f..f500a12d 100644 --- a/packages/community/list/index.vue +++ b/packages/community/list/index.vue @@ -124,9 +124,9 @@ export default { return item; }); - // 过滤出距离1km以内的数据 + // 过滤出距离1km以内的数据,确保距离为0的值也能被正确保留 processedList = processedList.filter(item => - item.distanceValue && item.distanceValue <= 1 + item.distanceValue !== undefined && item.distanceValue !== null && item.distanceValue <= 1 ); // 调用腾讯地图API获取附近1km的小区(包含图片信息) @@ -179,10 +179,10 @@ export default { mergedList = uniqueByField(mergedList, 'community_id'); } - // 根据距离排序 + // 根据距离排序,确保距离为0的值也能正确排序 mergedList.sort((a, b) => { - const distanceA = a.distanceValue || Infinity; - const distanceB = b.distanceValue || Infinity; + const distanceA = a.distanceValue !== undefined && a.distanceValue !== null ? a.distanceValue : Infinity; + const distanceB = b.distanceValue !== undefined && b.distanceValue !== null ? b.distanceValue : Infinity; return distanceA - distanceB; });