ionic2 -- 分页

界面:


        

js:

doInfinite(infiniteScroll) {
    console.log( this.pageIndex ++);
    if(this.isLoadOver == true){
      infiniteScroll.enable(false);
      this.presentToast();
      return;
    }
    this.infiniteScroll = infiniteScroll;
    this.initCouponList(this.selectedIndex);
  }

js:

initCouponList(index) {
    if(!this.checkLoginState()) {
      return false;
    }
    if(this.infiniteScroll) {
      this.infiniteScroll.complete();
    }
    let storeId = "";
    if(this.storeList.length > 0) {
      storeId = this.storeList[index]["entity_id"] || "";
    }
    let param = {
      method: "getmyproductlistreq",
      storeId: storeId,
      productType: this.productType,
      page: this.pageIndex+"",
      rows: "10",
      userId: this.userService.staffInfo["staff_id"],
      platform: "000",
      entityType: this.userService.chosenBusiness["entity_type"]
    }
    let crowds = this;
    this.httpService.post({}, param).subscribe(
      data => {
        let rsList = ((data["root"]||{})["body"]||{})["productList"]||[];
        if(rsList.length < 10) {
          this.isLoadOver = true;
        }
        this.couponList = this.couponList.concat(((data["root"]||{})["body"]||{})["productList"]||[]);
      }
    );
  }

你可能感兴趣的:(ionic2 -- 分页)