推荐使用es6的语法,更简洁,不会出现该现象,外层的success改成最外层的.then(res => {}),你把success最外层放一下,下面是一个示例
wx.cloud.callFunction({
name: ‘’,
data: data
}).then(res => {
})
}
用箭头函数,或者在外面定义 let that = this,然后that. setData