getdata(){
let that=this
wx.cloud.callFunction({
name:"callback",
success(res){console.log("request success",res);
that.setData({
datalist:res.result.data
})
},
fail(res){console.log("request success",res)}
})
console.log(datalist)
},
代码console.log(datalist)提示ReferenceError: datalist is not defined
success(res){console.log("request success",res);这个执行成功了
取data里面的值是this.data.datalist 而且你的代码有异步问题,需要在success里面打印