繁体   English   中英

在Ionic3中下拉刷新时出错

[英]Error when pull down for refreshing in Ionic3

嘿,我试图通过降低离子性来刷新我的产品列表。 第一次工作,但之后又出现此错误

Error: Uncaught (in promise): removeView was not found
    at c (http://localhost:8101/build/polyfills.js:3:19752)
    at c (http://localhost:8101/build/polyfills.js:3:19461)
    at http://localhost:8101/build/polyfills.js:3:20233
    at t.invokeTask (http://localhost:8101/build/polyfills.js:3:15660)
    at Object.onInvokeTask (http://localhost:8101/build/vendor.js:5125:33)
    at t.invokeTask (http://localhost:8101/build/polyfills.js:3:15581)
    at r.runTask (http://localhost:8101/build/polyfills.js:3:10834)
    at o (http://localhost:8101/build/polyfills.js:3:7894)

我刷新内容的代码是For HTML

<ion-refresher (ionRefresh)="doRefresh($event)">
        <ion-refresher-content  pullingIcon="arrow-dropdown"
        pullingText="Pull to refresh"
        refreshingSpinner="circles"
        refreshingText="Refreshing..."></ion-refresher-content>
    </ion-refresher>

在TS文件中

doRefresh(refresher) {
    console.log('Begin async operation', refresher);

    let loading = this.loadingCtrl.create({
      spinner: 'hide',
      content: `<img src="./assets/imgs/gif.svg" class="h15" />`,
    });
    this.service.getBrand().then((response:any)=>{
      loading.dismiss();
      this.brandlist = response;
    });
    this.serv.getProductList(this.sub_categoryes,this.filterCopy,this.newarrival,this.brand).then((response:any)=>{
      loading.dismiss();
      console.log(response);

      this.productlist = response;
      this.tmp_arr=response;
    });
    loading.present();
  }

当您手动调用dismiss ,您需要等到loading.present()解决

 this.loading.present().then(() => {
    this.service.getBrand().then((response: any) => {
        loading.dismiss();
        this.brandlist = response;
    });

    this.serv.getProductList(this.sub_categoryes, this.filterCopy, this.newarrival, this.brand).then((response: any) => {
        loading.dismiss();
        console.log(response);

        this.productlist = response;
        this.tmp_arr = response;
    });

});

检查一下

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM