From 09405f658cb1455091f1923312bfffc85510d06a Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Wed, 19 Oct 2022 12:06:54 +0800 Subject: [PATCH] =?UTF-8?q?fix(translateGeo):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=20Coordinates=20=E5=B1=9E=E6=80=A7=E4=B8=A2?= =?UTF-8?q?=E5=A4=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/uni-h5/src/helpers/location.ts | 33 ++++++++++++++----------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/packages/uni-h5/src/helpers/location.ts b/packages/uni-h5/src/helpers/location.ts index dbd43bbf7..134875911 100644 --- a/packages/uni-h5/src/helpers/location.ts +++ b/packages/uni-h5/src/helpers/location.ts @@ -1,4 +1,3 @@ -import { extend } from '@vue/shared' import { getJSONP } from './getJSONP' import { loadMaps } from '../view/components/map/maps' @@ -89,13 +88,16 @@ export function translateGeo( 'points' in res.detail && res.detail.points.length ) { - const location = res.detail.points[0] - resolve( - extend({}, coords, { - longitude: location.lng, - latitude: location.lat, - }) - ) + const { lng, lat } = res.detail.points[0] + resolve({ + longitude: lng, + latitude: lat, + altitude: coords.altitude, + accuracy: coords.accuracy, + altitudeAccuracy: coords.altitudeAccuracy, + heading: coords.heading, + speed: coords.speed, + }) } else { resolve(coords) } @@ -113,12 +115,15 @@ export function translateGeo( (_: string, res: any) => { if (res.info === 'ok' && res.locations.length) { const { lat, lng } = res.locations[0] - resolve( - extend({}, coords, { - longitude: lng, - latitude: lat, - }) - ) + resolve({ + longitude: lng, + latitude: lat, + altitude: coords.altitude, + accuracy: coords.accuracy, + altitudeAccuracy: coords.altitudeAccuracy, + heading: coords.heading, + speed: coords.speed, + }) } else { resolve(coords) } -- GitLab