Authored by lijing

防止快速下拉,多次请求数据

... ... @@ -22,23 +22,27 @@ class GradeController extends Controller {
this.content = new GetContent();
this.content.on('search', this.doSearch.bind(this));
this.page = 1;
this.loading = false;
}
doSearch() {
if (!this.end) {
if (!this.end && !this.loading) {
this.page ++;
this.search(this.page);
}
}
search(page) {
this.loading = true;
search('//m.yohobuy.com/home/gradeNew/getHis', {page: page}).then(data => {
if (data.detailHis <= 0) {
this.end = true;
} else {
$('.ul-detail:first').append(hisContent(data));
}
}).catch(() => {});
}).catch(() => {}).finally(() => {
this.loading = false;
});
}
}
... ...