geoCode() {
var geocoder = new AMap.Geocoder({
city: "",
});
var address = this.form.address;
geocoder.getLocation(address, function(status, result) {
if (status === 'complete' && result.geocodes.length) {
var lnglat = result.geocodes[0].location
console.log(lnglat);
} else {
console.log('根据地址查询位置失败');
}
});
}
网友评论