提交 2aaef88f 编写于 作者: D DCloud_LXH

feat: getLocation add isHighAccuracy

上级 aa2ba317
......@@ -53,6 +53,7 @@ export function getLocation ({
type = 'wgs84',
geocode = false,
altitude = false,
isHighAccuracy = false,
highAccuracyExpireTime
} = {}, callbackId) {
const errorCallback = warpPlusErrorCallback(callbackId, 'getLocation')
......@@ -69,7 +70,7 @@ export function getLocation ({
errorCallback(e)
}, {
geocode: geocode,
enableHighAccuracy: altitude,
enableHighAccuracy: isHighAccuracy || altitude,
timeout: highAccuracyExpireTime
}
)
......
......@@ -14,6 +14,7 @@ import {
export function getLocation ({
type,
altitude,
isHighAccuracy,
highAccuracyExpireTime
}, callbackId) {
const {
......@@ -24,7 +25,7 @@ export function getLocation ({
new Promise((resolve, reject) => {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(res => resolve(res.coords), reject, {
enableHighAccuracy: altitude,
enableHighAccuracy: isHighAccuracy || altitude,
timeout: highAccuracyExpireTime || 1000 * 100
})
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册