用户信息授权按钮怎么回调其他方法 比如confirm()方法
Page({
data: {
canIUse: wx.canIUse('button.open-type.getUserInfo')
},
bindGetUserInfo:function(){
that.confirm()
// 查看是否授权
wx.getSetting({
withCredentials:true ,
success: res => {
if (res.authSetting['scope.userInfo']) {
wx.getUserInfo({
success: res => {
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>
以下是代码片段
不太明白你想要干什么。另外,方法体里面应该是this 而 不是 that