微信小程序授权拒绝后就不弹出授权窗了?
发布于 5 年前 作者 fangshen 16389 次浏览 来自 问答

微信小程序授权拒绝后就不弹出授权窗了?

授权页面代码如下

Page({

onLaunch:function(){

},

onShow: function () {

wx.setNavigationBarTitle({

title: ‘授权’

})

},

authorizeInfo: function () {

wx.authorize({

scope: ‘scope.userInfo’,

success() {

wx.switchTab({

url: ‘/pages/index/index’,

})

}, fail(res) {

wx.openSetting({

success: (res) => {

// if (!res.authSetting[“scope.userInfo”]) {

//   res.authSetting = {

//     “scope.userInfo”: true

//   }

// }

if (res.authSetting[“scope.userInfo”]) {

wx.switchTab({

url: ‘/pages/index/index’,

})

}

}

})

}

})

}

});

1 回复

opensetting打开授权列表,引导用户点击允许获取信息

回到顶部