收藏
回答

用户信息授权按钮怎么回调其他方法?

用户信息授权按钮怎么回调其他方法 比如confirm()方法

Page({
  data: {
    canIUse: wx.canIUse('button.open-type.getUserInfo')
  },
  bindGetUserInfo:function(){
    that.confirm()
    // 查看是否授权
    wx.getSetting({
      withCredentials:true ,
      successres => {            
        if (res.authSetting['scope.userInfo']) {
          wx.getUserInfo({
            successres => {            
              console.log(res)
              var userInfo = res.userInfo
              console.log(userInfo)
            }
          })
        }
      }
    })
},
confirm:function() {
  console.log("测试")
},
})
<view class="submit" style="margin-top:70px;">
  <button wx:if="{{canIUse}}" id="dologin" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">手机一键登录</button>
</view>

以下是代码片段

https://developers.weixin.qq.com/s/ox54fVm17fgg

回答关注问题邀请回答
收藏

1 个回答

  • 微盟
    微盟
    2020-04-27

    不太明白你想要干什么。另外,方法体里面应该是this 而 不是 that

    2020-04-27
    有用
    回复
登录 后发表内容
问题标签