Page,onload中请求成功获取值后,返回值:data.payload.bookInfo.pages
代码
pagesTMP = data.payload.bookInfo.pages;
pagesData = data.payload.bookInfo.pages;
if (pagesTMP) {
if (pagesTMP.length > 5) {
pagesTMP.forEach(function (val, index) {
if (index >= pagesLimit) {
pagesTMP[index].imgUrl = ‘’;
}
});
that.setData({
bookInfo: data.payload.bookInfo,
pages: pagesTMP
});
} else {
that.setData({
bookInfo: data.payload.bookInfo,
pages: pagesTMP
});
}
}
console.log(that.data.pages);
console.log(pagesData);
这里只修改了pagesTMP中的imgUrl,但是最终输出 pagesData 与 pagesTMP数值一样。