提交 09405f65 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

fix(translateGeo): 修复转换 Coordinates 属性丢失问题

上级 726b8024
import { extend } from '@vue/shared'
import { getJSONP } from './getJSONP' import { getJSONP } from './getJSONP'
import { loadMaps } from '../view/components/map/maps' import { loadMaps } from '../view/components/map/maps'
...@@ -89,13 +88,16 @@ export function translateGeo( ...@@ -89,13 +88,16 @@ export function translateGeo(
'points' in res.detail && 'points' in res.detail &&
res.detail.points.length res.detail.points.length
) { ) {
const location = res.detail.points[0] const { lng, lat } = res.detail.points[0]
resolve( resolve({
extend({}, coords, { longitude: lng,
longitude: location.lng, latitude: lat,
latitude: location.lat, altitude: coords.altitude,
}) accuracy: coords.accuracy,
) altitudeAccuracy: coords.altitudeAccuracy,
heading: coords.heading,
speed: coords.speed,
})
} else { } else {
resolve(coords) resolve(coords)
} }
...@@ -113,12 +115,15 @@ export function translateGeo( ...@@ -113,12 +115,15 @@ export function translateGeo(
(_: string, res: any) => { (_: string, res: any) => {
if (res.info === 'ok' && res.locations.length) { if (res.info === 'ok' && res.locations.length) {
const { lat, lng } = res.locations[0] const { lat, lng } = res.locations[0]
resolve( resolve({
extend({}, coords, { longitude: lng,
longitude: lng, latitude: lat,
latitude: lat, altitude: coords.altitude,
}) accuracy: coords.accuracy,
) altitudeAccuracy: coords.altitudeAccuracy,
heading: coords.heading,
speed: coords.speed,
})
} else { } else {
resolve(coords) resolve(coords)
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册