我的项目里 小程序端执行没问题,真机测试也没问题,H5在本地没问题,但是只要是微信里打开的这个H5就无法执行,会停在loading状态堵塞,手机其他浏览器也没这个问题,别的浏览器都会弹出一个定位确认的框,微信不弹啊,这咋整,急死
getlocation() {
// 先显示加载提示
uni.showLoading({
title: '获取位置中...'
});
uni.getLocation({
type: "gcj02",
isHighAccuracy: true,
success: (res) => {
uni.chooseLocation({
latitude: res.latitude,
longitude: res.longitude,
success: (res) => {
uni.setStorageSync('location', res)
this.form.location = res.name
},
fail: function(err) {
console.log('取消选择或出错:', err);
},
complete: function() {
console.log('选择位置操作完成');
uni.hideLoading()
}
});
}
})
},
1 个回复
张小怂
错误信息也没有么? 用 微信开发者工具的 公众号网页 调试一下试试呢