uni.getLocation({
type: 'gcj02', // 坐标类型,默认为wgs84,可选的值为gcj02和bd09ll
success: res => {
// 获取成功,经度和纬度在res.longitude和res.latitude中
console.log('res', res);
console.log('longitude1111111111:', res.longitude);
console.log('latitude11111111111:', res.latitude);
},
fail: err => {
// 获取失败,err为错误信息
console.log('获取位置失败:', err);
}
}); - 发布:2024-07-31 16:51
- 更新:2024-08-02 20:09
- 阅读:320
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: 21H2
HBuilderX类型: 正式
HBuilderX版本号: 4.24
手机系统: Android
手机系统版本号: Android 9.0
手机机型: 东极D60
页面类型: vue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
示例代码:
操作步骤:
{
"errMsg": "getLocation:fail getLocation:fail not support gcj02"
}
{
"errMsg": "getLocation:fail getLocation:fail not support gcj02"
}
预期结果:
{
"errMsg": "getLocation:fail getLocation:fail not support gcj02"
}
{
"errMsg": "getLocation:fail getLocation:fail not support gcj02"
}
实际结果:
{
"errMsg": "getLocation:fail getLocation:fail not support gcj02"
}
{
"errMsg": "getLocation:fail getLocation:fail not support gcj02"
}
bug描述:
uni.getLocation获取不到经纬度,app模块配置勾选Geolocation-系统定位-android
1 个回复
DCloud_UNI_yuhe
系统定位,不支持gcj02