uni.getLocation({
type: 'gcj02',
geocode: true,
isHighAccuracy: true,
success: (res) => {
console.log('位置信息=',res);
}
})
//打印
{
"type": "gcj02",
"altitude": 5e-324,
"latitude": 5e-324,
"longitude": 5e-324,
"speed": 0,
"accuracy": 0,
"address": {},
"errMsg": "getLocation:ok"
}
- 发布:2022-12-07 10:16
- 更新:2023-08-18 11:34
- 阅读:489
产品分类: uniapp/App
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: macOs Monterey 12.6
HBuilderX类型: 正式
HBuilderX版本号: 3.6.4
手机系统: Android
手机系统版本号: Android 11
手机厂商: 华为
手机机型: HUAWEI nova3 HarmonyOs 2.00
页面类型: vue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
App下载地址或H5⽹址: https://sj.qq.com/appdetail/com.buyleejoy.cm
示例代码:
操作步骤:
uni.getLocation({
type: 'gcj02',
geocode: true,
isHighAccuracy: true,
success: (res) => {
console.log('位置信息=',res);
}
})
uni.getLocation({
type: 'gcj02',
geocode: true,
isHighAccuracy: true,
success: (res) => {
console.log('位置信息=',res);
}
})
预期结果:
返回值有经纬度和adress信息
返回值有经纬度和adress信息
实际结果:
{
"type": "gcj02",
"altitude": 5e-324,
"latitude": 5e-324,
"longitude": 5e-324,
"speed": 0,
"accuracy": 0,
"address": {},
"errMsg": "getLocation:ok"
}
{
"type": "gcj02",
"altitude": 5e-324,
"latitude": 5e-324,
"longitude": 5e-324,
"speed": 0,
"accuracy": 0,
"address": {},
"errMsg": "getLocation:ok"
}
bug描述:
uni.getLocation只有部分机型获取位置之后,经纬度错误,用的百度地图
uni.getLocation({
type: 'gcj02',
geocode: true,
isHighAccuracy: true,
success: (res) => {
console.log('位置信息=',res);
}
})
//打印
{
"type": "gcj02",
"altitude": 5e-324,
"latitude": 5e-324,
"longitude": 5e-324,
"speed": 0,
"accuracy": 0,
"address": {},
"errMsg": "getLocation:ok"
}
8***@qq.com - 懒宅
你好 我也是报这错误 请问是怎么解决的
"type": "gcj02",
"altitude": 5e-324,
"latitude": 5e-324,
"longitude": 5e-324,
"speed": 0,
"accuracy": 0,
"address": {},
"errMsg": "getLocation:ok"
baiyun_rain
请教一下, 百度地图获取位置报错. 是怎么解决的, 万分感谢!
2023-03-08 10:13