当高德地图精准定位失败时,在 onError
事件处理函数中调用方法 getLatLngLocation
当前为使用非精准定位 ip
定位,查询到当前所在城市的相关信息,然后进行逆地理编码。
如下:
created(){
this.getLocation()
},
methods: {
getLocation(){
// 从高德地图api获取浏览器定位
const that = this
AMap.plugin('AMap.Geolocation', function() {
let geolocation = new AMap.Geolocation({
// 是否使用高精度定位,默认&#