微信小程序获取定位 (小白版)
onload 掉这个
wx.authorize({
scope: 'userLocation',
success: res => {
console.log(res)
},
fial: e => {
console.log(e)
}
})
方法调这个
locationFail() { wx.getSetting({ success: function (res) { var statu = res.authSetting; var sul = statu['scope.userLocation'] if (sul == undefined) { that.getLocation() } else if (!statu['scope.userLocation']) { wx.showModal({ title: '是否授权当前位置', content: '需要获取您的地理位置,请确认授权,否则地图功能将无法使用', success: function (tip) { if (tip.confirm) { wx.openSetting({ success: function (data) { if (data.authSetting["scope.us