8***@qq.com
8***@qq.com
  • 发布:2025-11-01 17:19
  • 更新:2025-11-01 17:56
  • 阅读:13

uni.getlocation在微信内置浏览器打开h5不执行

分类:uni-app

我的项目里 小程序端执行没问题,真机测试也没问题,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()  
                        }  
                    });  
                }  
            })  

        },  
2025-11-01 17:19 负责人:无 分享
已邀请:
张小怂

张小怂

错误信息也没有么? 用 微信开发者工具的 公众号网页 调试一下试试呢

要回复问题请先登录注册