diff --git a/src/game_pages/detail/components/GameInfo/index.tsx b/src/game_pages/detail/components/GameInfo/index.tsx index fba6529..1d2075b 100644 --- a/src/game_pages/detail/components/GameInfo/index.tsx +++ b/src/game_pages/detail/components/GameInfo/index.tsx @@ -59,8 +59,10 @@ export default function GameInfo(props) { }; const [c_latitude, c_longitude] = currentLocation; + // 判断当前位置是否有效(不是初始值 [0, 0]) + const is_current_location_valid = c_latitude !== 0 && c_longitude !== 0; const distance = - latitude && longitude + latitude && longitude && is_current_location_valid ? calculateDistance(c_latitude, c_longitude, latitude, longitude) / 1000 : 0; @@ -183,8 +185,8 @@ export default function GameInfo(props) { {longitude && latitude && ( {}} // hide business msg