在手机客户端运行, console.log(re)会出现如图片所示getUSerInfo:fail data no response
<button bindgetuserinfo=“bindgetuserinfo” open-type=‘getUserInfo’>登录button>
bindgetuserinfo: function (e) {
wx.showLoading({
title: ‘数据加载中……’,
})
console.log(e)
if (e.detail.errMsg ==“getUserInfo:ok”){
app.toLogin(e.detail, function () {
wx.hideLoading()
that.setData({
authorization: “hide”
})
});
}else{
wx.hideLoading()
}
},
wx.getUserInfo({
complete: function (re) {
console.log(re)
if (re.errMsg == “getUserInfo:ok”) {
wx.showLoading({
title: ‘数据加载中……’,
})
app.toLogin(re, function () {
//执行登录成功后要执行的函数
})
that.setData({
authorization: “hide”
})
} else {
that.setData({
authorization: “”
})
}
}
})