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

feat(h5 getLocation): 支持高德地图

上级 3cf0a535
......@@ -67,6 +67,21 @@ export function getLocation ({
reject(new Error('network error'))
}
})
} else if (mapInfo.type === MapType.AMAP) {
window.AMap.plugin('AMap.Geolocation', function () {
var geolocation = new window.AMap.Geolocation({})
geolocation.getCurrentPosition(function (status, res) {
if (status === 'complete') {
resolve({
latitude: res.position.lat,
longitude: res.position.lng,
accuracy: res.accuracy
})
} else {
reject(new Error((res.message) || JSON.stringify(res)))
}
})
})
} else {
reject(new Error('network error'))
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册