先附上大佬链接,看了下日期,4.3,还热乎着!
https://new.qq.com/omn/20210403/20210403A028UO00.html
然后是我自己照着写的
wxml:
<!--pages/mine/mine.wxml-->
<button open-type="getUserInfo" bindtap="getUserProfile"> 授权获取头像昵称 </button>
js文件:
getUserProfile: function(e) {
console.log(e)
// console.log(wx.canIUse())
wx.getUserProfile({
desc: '用于完善会员资料',
success:(res)=>{
console.log(res)
},
fail:(res)=>{
console.log('用户点击取消!')
wx.showModal({
cancelColor: 'cancelColor',
title:'请点击授权!'
})
}
})
},
getUserInfo(e) {
// 不推荐使用getUserInfo获取用户信息,预计自2021年4月13日起,getUserInfo将不再弹出弹窗,并直接返回匿名的用户个人信息
console.log(e)
},
具体原因点击 https://new.qq.com/omn/20210403/20210403A028UO00.html 学习啦~