美文网首页
ionic2 -- 分页

ionic2 -- 分页

作者: 林ze宏 | 来源:发表于2018-01-04 15:37 被阅读0次

    界面:

    <ion-infinite-scroll (ionInfinite)="doInfinite($event)">
            <ion-infinite-scroll-content></ion-infinite-scroll-content>
    </ion-infinite-scroll>
    

    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 -- 分页

          本文链接:https://www.haomeiwen.com/subject/eyvrnxtx.html