欢迎您光临深圳塔灯网络科技有限公司!
电话图标 余先生:13699882642

网站百科

为您解码网站建设的点点滴滴

uni-app微信小程序第二次地理位置授权失败解决

发表日期:2019-11 文章编辑:小灯 浏览次数:6255

微信小程序第一次拒绝地理位置授权,是不可以再次谈起授权弹框的,想要再次授权只能打开设置面板

uni.openSetting({
  success(res) {
    console.log(res.authSetting)
  }
});
            getLocal() {
                uni.openSetting({
                    success: (res) => {
                        if(res.authSetting) {
                            var that = this
                            uni.getLocation({
                                type: 'gcj02',
                                success: function (res) {
                                    uni.request({
                                        url: 'https://apis.map.qq.com/ws/geocoder/v1/?location=' + res.latitude + ',' + res.longitude + '&key=Y4ZBZ-4WO6X-NOD4G-7LUEA-YUC2T-PYFZT',
                                        success: (address) => {
                                            that.saveLocalCity(address.data.result.address_component.city)
                                            that.activeCity.cityName = address.data.result.address_component.city
                                            console.log(that.activeCity.cityName)
                                        }
                                    })
                                },
                                fail:function(e){
                                    console.log(e)
                                }
                            });
                        }
                    }
                })
            }

本页内容由塔灯网络科技有限公司通过网络收集编辑所得,所有资料仅供用户学习参考,本站不拥有所有权,如您认为本网页中由涉嫌抄袭的内容,请及时与我们联系,并提供相关证据,工作人员会在5工作日内联系您,一经查实,本站立刻删除侵权内容。本文链接:https://www.dengtar.com/25258.html
相关小程序
 八年  行业经验

多一份参考,总有益处

联系深圳网站公司塔灯网络,免费获得网站建设方案及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:余经理:13699882642

Copyright ? 2013-2018 Tadeng NetWork Technology Co., LTD. All Rights Reserved.