vue高德地图输入详细地址转经纬度


var address =("北京")
AMap.plugin('AMap.Geocoder', function() {
var geocoder = new AMap.Geocoder();
geocoder.getLocation(address, function(status, result) {
if (status === 'complete' && result.info === 'OK') {
that.form.lng = result.geocodes[0].location.lng;
that.form.lat = result.geocodes[0].location.lat;
    console.log(that.form.lng,that.form.lat);
} else {
      console.log('定位失败!');
}
});
});
posted @ 2022-04-02 10:06  zhangzikang  阅读(733)  评论(0)    收藏  举报