cckui

用户授权

<button open-type="getUserInfo" bindgetuserinfo=\'getUser\'>授权用户信息</button>
getUser(e) {
    console.log(e);
    wx.getUserInfo({
        success: (res) => {
            console.log(res)
            this.setData({
                userInfo: res.userInfo
            });
        }
    })
}
  • 点击上面 button 后弹出授权窗口;
  • 如果用户同意授权,将获取到用户信息,再次点击button后不会弹窗。
  • 如果用户拒绝授权,不会获取到用户信息,再次点击按钮,会再次弹出授权窗口。

分类:

技术点:

相关文章:

  • 2021-07-13
  • 2021-11-21
  • 2021-11-20
  • 2021-11-28
  • 2022-02-07
  • 2021-12-09
  • 2021-07-04
猜你喜欢
  • 2021-12-05
  • 2021-11-10
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
  • 2021-09-24
相关资源
相似解决方案