已经改正了好几处这样的错误了,还有,实在找不出问题,请大神帮忙看一下,不胜感激!!!
data: {
userInfo: {},
canIUse: wx.canIUse(‘button.open-type.getUserInfo’)
},
onLoad: function (){
var that = this;
wx.getSetting
({
success(res) {
if (res.authSetting[‘scope.userInfo’]){
wx.getUserInfo({
success: function (res1){
var bmobUser = res1.result||{};
if (bmobUser.avatarUrl == ‘’ || bmobUser.avatarUrl == undefined) {
var resuserInfo = res.userInfo||{};
wx.changeUserInfo(resuserInfo.avatarUrl, resuserInfo.nickName).then(res2 => { }); //错误提示处
}
错误提示如下:
VM3292:1 Setting data field “userInfo” to undefined is invalid.
Cannot read property ‘changeUserInfo’ of undefined;at api operateWXData success callback function
TypeError: Cannot read property ‘changeUserInfo’ of undefined