在调用uni.getLocation的时候设置了sdk,用的gck02,但是在调用的时候并不能拿到address的数据,之前一直是运行在PC端浏览器上面,我也以为只是在pc端浏览器上面拿不到address,但是当我打包到之后,在手机app内嵌h5的页面里面任然拿不到address的数据。
以下是我getLocation的配置,希望各位大佬帮忙看看是什么原因。
getLocation(){
uni.getLocation({
type: 'gcj02',
// altitude:true,
geocode:true,
accuracy:'best',
isHighAccuracy:true,
success:(res)=>{
this.latitude = res.latitude
this.longitude = res.longitude
this.defaultCity = res.address.city
}
})
},
1 个回复
Misaka_dh (作者)
这个方法调用之后成功的返回信息
{
"longitude":有值,
"latitude":有值,
"errMsg":"getLocation:ok",
"verticalAccuracy":0
}
就只有这四个参数,其他的参数就没有了。
然而我还需要拿到当前经纬度下城市的名称。不知道是不是哪里配置的问题。有没有大佬能解决一下。