求助:原来用的是getUserInfo,怎么改成getUserProfile?
求助:原来用的是getUserInfo,怎么改成getUserProfile?用下面的代码,按钮点了没反映,调用不了微信头像。
wxml:
<button open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo" class="btn">使用微信头像</button>
js:
bindGetUserInfo (e) {
const that = this
wx.getUserProfile({
success (res){
if (res.authSetting['scope.userInfo']) {
wx.getUserInfo({
success: function(res) {
wx.downloadFile({
url: res.userInfo.avatarUrl,
success (res) {
console.log(res.tempFilePath)
if (res.statusCode === 200) {
that.setData({
imgg:res.tempFilePath
})
that.create()
}
}
})
}
})
}
}
})
},