getUserProfile(e) {
// 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
// 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
wx.getUserProfile({
desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (res) => {A
this.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
}
})
},
你好我这边复现不出来,,请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
getUserProfile() {
// 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
// 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
uni.getUserProfile({
desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (res) => {
this.updateUserInfo(res.userInfo)
this.getToken(res)
},
fail:(res)=>{
return uni.$showMsg('您取消了授权登录')
}
})
},
这个A干嘛的
uniapp直接使用this.userInfo = res.userInfo
这能有什么问题?
getUserProfile() {
let that = this
wx.getUserProfile({
desc: '获取你的用户信息用于展示',
success: res => {
console.debug(res)
that.setData({
userInfo: res.userInfo
})
}
})
}