Browse Source

测试百度地图

develop
nesxy 6 years ago
parent
commit
e0b8c087b0
1 changed files with 5 additions and 4 deletions
  1. 9
      src/view/home.vue

9
src/view/home.vue

@ -462,8 +462,9 @@ export default {
},
getCity(){
let _this = this
alert(this.Bmap)
var geolocation = this.Bmap.Geolocation();
if (!this.BMap) return false
let BMap = this.BMap
var geolocation = new Bmap.Geolocation();
geolocation.getCurrentPosition(function(r) {
if (this.getStatus() == BMAP_STATUS_SUCCESS) {
if(r.accuracy==null){
@ -471,8 +472,8 @@ export default {
//
return;
}else{
const myGeo = this.Bmap.Geocoder()
myGeo.getLocation(this.Bmap.Point(r.point.lng, r.point.lat), data => {
const myGeo = new Bmap.Geocoder()
myGeo.getLocation(new Bmap.Point(r.point.lng, r.point.lat), data => {
if (data.addressComponents) {
const result = data.addressComponents
const location = {

Loading…
Cancel
Save