1 回复
以下代码片段仅供参考:
wx.getSetting({ success(res) { if (res.authSetting['scope.userLocation'] != undefined && res.authSetting['scope.userLocation'] != true) { wx.openSetting({ success: function (res) { if (res.authSetting["scope.userLocation"] == true) { wx.showToast({ title: '授权成功', icon: 'success', duration: 1000 }) wx.getLocation({ type: 'wgs84', success: function (res) { console.log('地理位置', res) } }) } } }) } else if (res.authSetting['scope.userLocation'] == undefined) { wx.getLocation({ type: 'wgs84', success: function (res) { console.log('地理位置',res) } }) } } }) } |
