uni.getLocation({type: 'wgs84',});
H5定位几十秒才回调, 等待时间太长, 有时候甚至一直不回调, fail/compete/success也没数据
有更换了sdk key ,https
这个怎么解决呢?
uni.getLocation({type: 'wgs84',});
H5定位几十秒才回调, 等待时间太长, 有时候甚至一直不回调, fail/compete/success也没数据
有更换了sdk key ,https
这个怎么解决呢?
这是上述链接对应.vue 完整代码
<template>
<view>
<view>latitude:----{{latitude}}</view>
<view>longitude:----{{longitude}}</view>
<map class='map' :latitude="latitude" :longitude="longitude" :show-location="true" :scale="10" />
</view>
</template>
<script>
export default {
data() {
return {
latitude: 0,
longitude: 0,
}
},
onReady() {
uni.getLocation({
type: 'gcj02',
success:(res) => {
console.log('getLocation success',res);
this.longitude = res.longitude
this.latitude = res.latitude
},
complete(res) {
console.log('getLocation complete',res)
}
})
}
}
</script>
<style>
.map{
width: 350px;
height: 300px;
}
</style>
建议新建默认模板验证是否符合预期,如符合预期,对比确认你现有项目问题点
3***@qq.com (作者)
回复 DCloud_UNI_WZF: 能发下你完整的代码吗? 新建项目还是一样不行, 用uniapp的demo也不可以, 只有你链接可以, 我复制你的vue文件也不行,
2023-03-12 14:57
回复 3***@qq.com: https://github.com/zhenyuWang/uniapp-test-project/tree/main/component/map
2023-03-13 10:01
3***@qq.com (作者)
用了腾讯和高德key都是一样, 延迟十几秒后偶尔有回调数据, 也更换了很多key, 开了4G都一样不行., 其他网站可以正常定位
2023-02-23 15:14
DCloud_UNI_WZF
回复 3***@qq.com: 测试该链接 http://114.115.235.59/map/#/pages/getLocation/getLocation getLocation 响应时间符合预期
2023-02-23 15:45
3***@qq.com (作者)
回复 DCloud_UNI_WZF: 这个可以, 1秒内里面拿到坐标数据了
2023-02-23 17:13