this.mapContext.getCenterLocation({
// type: 'gcj02',
// geocode: true,
// isHighAccuracy: true,
// altitude: true,
success: (res) => {
console.log(res)
this.location.longitude = res.longitude
this.location.latitude = res.latitude
if (this.enableLocationScope) {
const discount = this.jnpf.getDistance(this.currentLocation.latitude, this
.currentLocation.longitude, this.location.latitude, this.location.longitude
) || 0;
if (discount > (this.adjustmentScope || 500)) return this.$refs.uTips.show({
title: '超出微调范围',
type: 'warning',
});
}
this.getList()
}
})

- 发布:2025-05-28 11:38
- 更新:2025-05-30 16:05
- 阅读:126
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: 11
HBuilderX类型: 正式
HBuilderX版本号: 4.66
手机系统: Android
手机系统版本号: Android 16
手机厂商: 小米
手机机型: 小米
页面类型: vue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
示例代码:
操作步骤:
无
无
预期结果:
获取到中心点坐标
获取到中心点坐标
实际结果:
返回{},获取不到中心点坐标
返回{},获取不到中心点坐标
9***@qq.com (作者)
测试了,没有进入fail,截图在下面
2025-05-28 13:56
DCloud_UNI_yuhe
回复 9***@qq.com: 也可能是hbuilderx的问题,是控制台不显示了,但是实际上是有值的,你直接打印res中的数值试一下,如果它没.latitude之类的,那么应该直接报错
2025-05-28 14:33
9***@qq.com (作者)
回复 DCloud_UNI_yuhe测了一下,直接打印是undefined
2025-05-28 14:44
DCloud_UNI_yuhe
回复 9***@qq.com: 你之前是好的吗?是升级产生的吗?使用的自定义基座吗?
2025-05-28 14:47
9***@qq.com (作者)
回复 DCloud_UNI_yuhe:之前是可以的,是直接运行到安卓app基座
2025-05-28 14:51