使用mpvue开发小程序,在A页面onLoad时请求接口并赋值渲染,代码如下
methods: {
getReadList() {
this.bookList = [];
request(`book/all`, "GET").then(res => {
if (res.status == 1000) {
res.content.forEach(item => {
this.bookList.push(item)
});
}
});
}
},
onLoad() {
this.getReadList();
}
但是在app.json中配置了plugins后,A页面渲染不出bookList的数据。
在请求回调中不通过forEach循环,直接用this.bookList = res.content能正常渲染。
很困惑,这到底是什么原因呢?