1 回答
TA贡献1886条经验 获得超2个赞
通过控制loadMore判断是否有加载更多 参考代码示例
<ion-infinite-scroll (ionInfinite)="doInfinite($event)" [threshold]="'10%'" [enabled]="loadMore">
<ion-infinite-scroll-content [loadingSpinner]="'bubbles'">
</ion-infinite-scroll-content>
</ion-infinite-scroll>
doInfinite(infiniteScroll) {
let id = this.lists[this.lists.length - 1]["id"];
let params = {
'Id': id,
'getPast': 'true'
};
this._demoService.list(params)
.subscribe((result) => {
if (result.data.length > 0) {
this.lists = this.lists.concat(result.data);
}
infiniteScroll.complete();
this.loadMore = result.data.length == 10; //一次请求多少条
}, (err) => {
infiniteScroll.complete();
});
}
添加回答
举报