const app = getApp ()
Page ({
data: {
questions:{},
},
onLoad: function (options) {
this.requestTopic(this);
},
onReady: function () {
},
onShow: function () {
console.log(this.data);
console.log(this.data.questions);
},
requestTopic: (that) = >
{
var params = { action: "topics"};
wxApi.postRequest(app.globalData.serverUrl, params).then(
(res) => {
that.data.questions = res.data;
//that.setData({ questions: res.data })
})
}
})
the code has been simplified. In onShow, console.log (this.data.questions); why can"t you get the value-_!