data: {
navigateTitle: "",
movies:[],//重要
requesUrl:"",
totalCount:0
},
processDoubanData:function(moviesDouban){
var movies = this.data.movies;//重要
for(var idx in moviesDouban.subjects){
var subject = moviesDouban.subjects[idx];
var title = subject.title;
if(title.length>=6){
title = title.substring(0,6) + "...";
}
var temp = {
stars:util.convertToStarsArray(subject.rating.stars),
title:title,
average:subject.rating.average,
coverageUrl:subject.images.large,
movieId:subject
}
movies.push(temp);//重要
}
this.setData({
totalCount:this.data.totalCount += 20
})
this.setData({
movies:movies//重要
});
wx.hideNavigationBarLoading();
wx.stopPullDownRefresh();
},
关于加载数据这里,看老师写得好复杂,我标记重要这里是可以简化代码的
4年同步微信官方迭代,累计20000+人学习, 比微信官方更火爆!
了解课程