wxml:
<button open-type='getUserInfo' bindgetuserinfo='userinfo'>点击获取</button>
js:
getUserInfo: function (e) { var that = this wx.login({ success: function () { wx.getUserInfo({ success: function (res) { console.log('用户'); console.log(res); console.log('信息'); // that.setData({ // userInfo: res.userInfo // }); }, fail: function (ee) { console.log(ee) console.log('error'); } }) }, fail: function () { } }) },
评论前必须登录!
注册