Browse Source

测试百度地图

develop
nesxy 6 years ago
parent
commit
b42f42dbb2
1 changed files with 6 additions and 6 deletions
  1. 12
      src/view/home.vue

12
src/view/home.vue

@ -465,11 +465,11 @@ export default {
var geolocation = new BMap.Geolocation(); var geolocation = new BMap.Geolocation();
geolocation.getCurrentPosition(function(r) { geolocation.getCurrentPosition(function(r) {
if (this.getStatus() == BMAP_STATUS_SUCCESS) { if (this.getStatus() == BMAP_STATUS_SUCCESS) {
if(r.accuracy==null){
alert('您已拒绝地理位置授权');
//
return;
}else{
// if(r.accuracy==null){
// alert('');
// //
// return;
// }else{
const myGeo = new BMap.Geocoder() const myGeo = new BMap.Geocoder()
myGeo.getLocation(new BMap.Point(r.point.lng, r.point.lat), data => { myGeo.getLocation(new BMap.Point(r.point.lng, r.point.lat), data => {
if (data.addressComponents) { if (data.addressComponents) {
@ -486,7 +486,7 @@ export default {
alert("省-"+location.creditProvince+";市-"+location.creditCity+";区-"+location.creditArea+";街道-"+location.creditStreet+";lat-"+location.creditLatitude+";lng-"+location.creditLongitude); alert("省-"+location.creditProvince+";市-"+location.creditCity+";区-"+location.creditArea+";街道-"+location.creditStreet+";lat-"+location.creditLatitude+";lng-"+location.creditLongitude);
} }
}) })
}
// }
} }
}) })
}, },

Loading…
Cancel
Save