diff --git a/packages/uni-h5/src/helpers/location.ts b/packages/uni-h5/src/helpers/location.ts index dbd43bbf78b46b0ffbb9f30365af45220d9ca745..1348759112b07e34da494f1bc979ca3a3d3281f4 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) }