点击button按钮,弹出用户信息,之前写法是
<button open-type="getUserInfo"></button>
现在这种写法已经取消了,详情看官网wx.getUserProfile(Object object) | 微信开放文档 (qq.com)
现在使用wx.get wx.getUserProfile,结合bindtap或者catchtap使用
<button bindtap="getUserInfo">获取用户信息</button>
index.js中
getUserInfo(res){
wx.getUserProfile({
desc: '用于完善会员资料',
success:(res)=>{
this.setData({
userInfo:res.userInfo,
haUserInfo:true
})
}
})
},