1.高德开放平台申请key==https://lbs.amap.com/
2.代码
uni.request({
url: 'https://restapi.amap.com/v3/geocode/geo?address='+region+'&output=JSON&key=此处为高德开放平台申请的key',
header: {
'content-type': "application/x-www-form-urlencoded"
},
success: (res) => {
console.log("地理编码==" + JSON.stringify(res))
var data = res.data;
if (data.status == 1) {
var list=res.data.geocodes
var a=list[0].location
var b=a.split(',')
this.str_huoyun_longitude_chu=b[0]
this.str_huoyun_latitude_chu=b[1]
this.huoyun_chu=list[0].location
}
},
fail(err) {
}
});