m***@bugquit.com
m***@bugquit.com
  • 发布:2023-04-13 09:56
  • 更新:2023-06-27 13:52
  • 阅读:664

uni.getLocation H5 已配置高德key,拒绝时异常无法捕获,失败函数也没有进入(uniapp vue2)

分类:HTML5+

配置高德key,询问时运行能正常通过success获取到定位数据,但是拒绝后,不论success,fail,complete函数都没有进去,包括使用try在外围包起来也捕获不到,直接报错

我的代码


uni.getLocation({  
                    type: 'gcj02',  
                    success: (res) => {  
                        console.log(res)  
                    },  
                    fail: (err) => {  
                        console.log(2)  
                        this.LocationInfo.err = true  
                    },  
                    complete:()=>{  
                        console.log(3)  
                    }  
                });  

报错代码


:20401  Uncaught (in promise) Error: Geolocation permission denied.Get ipLocation failed.  
    at r.<anonymous> (chunk-vendors.js:20401:7649)  
    at r.eval (eval at nS (maps?v=2.0&key=我的高德key&callback=__map_callback__AMap:1:188836), <anonymous>:1:20986)  
    at f (eval at nS (maps?v=2.0&key=我的高德key&callback=__map_callback__AMap:1:188836), <anonymous>:1:2520)  
    at u._invoke (eval at nS (maps?v=2.0&key=我的高德key&callback=__map_callback__AMap:1:188836), <anonymous>:1:2315)  
    at t.<computed> [as next] (eval at nS (maps?v=2.0&key=我的高德key&callback=__map_callback__AMap:1:188836), <anonymous>:1:2942)  
    at h (eval at nS (maps?v=2.0&key=我的高德key&callback=__map_callback__AMap:1:188836), <anonymous>:1:7821)  
    at r (eval at nS (maps?v=2.0&key=我的高德key&callback=__map_callback__AMap:1:188836), <anonymous>:1:8027)  
(匿名) @ chunk-vendors.js:20401  
e  
2023-04-13 09:56 负责人:DCloud_UNI_WZF 分享
已邀请:
DCloud_UNI_WZF

DCloud_UNI_WZF

HBuilderX 更新到 3.7.13 再试下

  • 1***@qq.com

    我的是最新正式版也是这个问题啊 请问官方在解决这个问题么

    2023-05-06 12:33

  • DCloud_UNI_WZF

    回复 1***@qq.com: 更到最新 alpha

    2023-05-06 13:24

  • 2***@qq.com

    回复 DCloud_UNI_WZF: alpha是实验版本,生产环境敢用吗

    2023-05-10 14:48

5***@qq.com

5***@qq.com

解决问题了吗

要回复问题请先登录注册