Page({
data: {
canIUse: wx.canIUse('button.open-type.getUserInfo')
},
onLoad: function() {
// 查看是否授权
wx.getSetting({
success (res){
if (res.authSetting['scope.userInfo']) {
// 已经授权,可以直接调用 getUserInfo 获取头像昵称
wx.getUserInfo({
success: function(res) {
console.log(res.userInfo)
}
})
}
}
})
},
bindGetUserInfo (e) {
console.log(e.detail.userInfo)
} 这里是不是漏了一个逗号
})
漏没漏的意义不大了,后面都要废除了
https://developers.weixin.qq.com/community/develop/doc/00022c683e8a80b29bed2142b56c01?page=25#comment-list