<button class="weui-btn mini-btn" type="primary" open-type="getUserInfo" bindgetuserinfo="getUserInfo">允许登录</button>
getUserInfo: function (e) {
var userInfo = e.detail.userInfo;
wx.setStorageSync('avatar_url', userInfo.avatarUrl);//用户授权账号登录,这个地方偶尔报如下错误,不知道何故
}
===============================================
Cannot read property 'avatarUrl' of undefined;at App login function;at api login success callback function
TypeError: Cannot read property 'avatarUrl' of undefined
at success (https://miniprogram:///app.js:218:50)
at Function.o.<computed> (https://lib/WASubContext.js:2:1269189)
at y (https://lib/WASubContext.js:2:409283)
at v (https://lib/WASubContext.js:2:409526)
at https://lib/WASubContext.js:2:411075
我本地测试都是ok的,这个报错是微信后台提示的报错记录,无法调试哦
log一下userInfo先呗。