微信小程序第一次拒绝地理位置授权,是不可以再次谈起授权弹框的,想要再次授权只能打开设置面板
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)
}
});
}
}
})
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。