提交 df7497c8 编写于 作者: Q qiang

fix: getLocation from GeolocationCoordinates

上级 0d502d80
...@@ -16478,12 +16478,15 @@ const getLocation = /* @__PURE__ */ defineAsyncApi(API_GET_LOCATION, ({type, alt ...@@ -16478,12 +16478,15 @@ const getLocation = /* @__PURE__ */ defineAsyncApi(API_GET_LOCATION, ({type, alt
}, () => resolve2(coords)); }, () => resolve2(coords));
}); });
}).then((coords) => { }).then((coords) => {
resolve(Object.assign({}, coords, { resolve({
latitude: coords.latitude,
longitude: coords.longitude,
accuracy: coords.accuracy,
speed: coords.altitude || 0, speed: coords.altitude || 0,
altitude: coords.altitude || 0, altitude: coords.altitude || 0,
verticalAccuracy: coords.altitudeAccuracy || 0, verticalAccuracy: coords.altitudeAccuracy || 0,
horizontalAccuracy: coords.accuracy || 0 horizontalAccuracy: coords.accuracy || 0
})); });
}).catch((error) => { }).catch((error) => {
reject(error.message); reject(error.message);
}); });
......
...@@ -85,15 +85,16 @@ export const getLocation = <API_TYPE_GET_LOCATION>defineAsyncApi( ...@@ -85,15 +85,16 @@ export const getLocation = <API_TYPE_GET_LOCATION>defineAsyncApi(
}) })
}) })
.then((coords: GeolocationCoordinates) => { .then((coords: GeolocationCoordinates) => {
resolve( resolve({
Object.assign({}, coords, { latitude: coords.latitude,
speed: coords.altitude || 0, longitude: coords.longitude,
altitude: coords.altitude || 0, accuracy: coords.accuracy,
verticalAccuracy: coords.altitudeAccuracy || 0, speed: coords.altitude || 0,
// 无专门水平精度,使用位置精度替代 altitude: coords.altitude || 0,
horizontalAccuracy: coords.accuracy || 0, verticalAccuracy: coords.altitudeAccuracy || 0,
}) // 无专门水平精度,使用位置精度替代
) horizontalAccuracy: coords.accuracy || 0,
})
}) })
.catch((error) => { .catch((error) => {
reject(error.message) reject(error.message)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册