微信小程序定位授权如何设置才能更精准?
- 内容介绍
- 文章标签
- 相关推荐
本文共计153个文字,预计阅读时间需要1分钟。
javascriptwx.getLocation({ type: 'wgs84', success: function(res) { var latitude=res.latitude; var longitude=res.longitude; wx.login({ // ... }); }, fail: function(res) { // 未开启定位权限,拉起授权 if (res.errMsg==='getLocation:fail auth deny') { // ... } }});
wx.getLocation({ type: 'wgs84', success: function (res) { var latitude = res.latitude; var longitude = res.longitude; wx.login({ }); }, fail: function (res) { //未开启定位权限,拉起授权 if (res.errMsg == 'getLocation:fail auth deny') { //重新拉起授权 wx.openSetting({ success: function (res) { if (res.authSetting['scope.userLocation'] == false) { wx.showModal({ title: '提示', content: '您未开启定位权限,将导致无法使用本软件', showCancel: false }); } else { wx.showModal({ title: '提示', content: '您已开启定位权限,请重新点击登录', showCancel: false }); } } }); } } })
本文共计153个文字,预计阅读时间需要1分钟。
javascriptwx.getLocation({ type: 'wgs84', success: function(res) { var latitude=res.latitude; var longitude=res.longitude; wx.login({ // ... }); }, fail: function(res) { // 未开启定位权限,拉起授权 if (res.errMsg==='getLocation:fail auth deny') { // ... } }});
wx.getLocation({ type: 'wgs84', success: function (res) { var latitude = res.latitude; var longitude = res.longitude; wx.login({ }); }, fail: function (res) { //未开启定位权限,拉起授权 if (res.errMsg == 'getLocation:fail auth deny') { //重新拉起授权 wx.openSetting({ success: function (res) { if (res.authSetting['scope.userLocation'] == false) { wx.showModal({ title: '提示', content: '您未开启定位权限,将导致无法使用本软件', showCancel: false }); } else { wx.showModal({ title: '提示', content: '您已开启定位权限,请重新点击登录', showCancel: false }); } } }); } } })

