let _this = this
LoadBaiduMapScript(function (){ //异步加载回调
let geolocation = new BMap.Geolocation()
geolocation.getCurrentPosition(
function (r) {
if (this.getStatus() === BMAP_STATUS_SUCCESS) {
let geoc = new BMap.Geocoder()
let point = new BMap.Point(r.point.lng, r.point.lat)
geoc.getLocation(point, function (rs) {
const loc = {addc: rs.addressComponents,point: rs.point}
sessionStorage.setItem('loc', JSON.stringify(loc))
_this.cb(loc)
})
} else {
return null
}
},
{ enableHighAccuracy: true }
)
})