wx.getSetting 和 wx.getUserInfo使用bug
发布于 6 年前 作者 xia31 10222 次浏览 来自 问答

1.wx.getSetting获取授权-> scope.userInfo:false  (之前是允许获取授权,在测试过程中通过授权按钮,关闭userInfo授权

2.点击授权按钮

<button open-type="getUserInfo" bindgetuserinfo="getUserInfoAuth">
无法获取头像&昵称,请允许微信授权。

</button>


getUserInfoAuth(e){
   console.log(e);
   if(e.detail.errMsg == 'getUserInfo:ok'){

       this.setData({
           booleanAuthItem:false
       })
   }
}


3.此时没有弹出授权弹窗 -> 打印log  ->  e.detail.errMsg:‘getUserInfo:ok’,能够获取到用户信息

回到顶部