Misaka_dh
Misaka_dh
  • 发布:2023-01-14 09:45
  • 更新:2023-01-15 16:35
  • 阅读:410

【问题】uni.getLocation,在App内嵌的h5页面,如何能够拿到当前城市的信息。

分类:uni-app

在调用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
}
})
},

2023-01-14 09:45 负责人:无 分享
已邀请:
Misaka_dh

Misaka_dh (作者)

这个方法调用之后成功的返回信息

{
"longitude":有值,
"latitude":有值,
"errMsg":"getLocation:ok",
"verticalAccuracy":0
}
就只有这四个参数,其他的参数就没有了。
然而我还需要拿到当前经纬度下城市的名称。不知道是不是哪里配置的问题。有没有大佬能解决一下。

要回复问题请先登录注册