解决方案:
wx.openSetting:调起客户端小程序设置界面
wxml文件
<button open-type='openSetting' bindopensetting="openSetting" size="mini">点击打开设置
js文件(调起客户端小程序设置界面)
openSetting: function(e) {//跳转授权设置之后的回调
const that = this
console.log('跳转授权设置之后的回调...')
const that = this
if (e.detail.authSetting['scope.userLocation']) { //此处同上同理
wx.getLocation({
type: 'wgs84',
success(res) {
const latitude = res.latitude
const longitude = res.longitude
const speed = res.speed
const accuracy = res.accuracy
that.getLocation() // 再次调用获取位置弹框
}
})
}
},
js文件(获取位置弹框)
getLocation() {
const that = this
// 获取位置信息弹窗
wx.getLocation({
type: 'wgs84',
success(res) {
const addressUrl =
&