离子4刷新器未传递进刷新对象,所以我无法完成它

问题描述 投票:0回答:1

[尝试完成复习时,出现错误

TypeError:refresh.complete不是函数。

。html:

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

。ts

load(refresher) {
    let postData = new FormData();
    postData.append('user_id', this.userData.userId);

    this.authService.postData(postData, "is_verified_or_not.php").then((result) => {
      this.responseData = result;

      this.success = this.responseData.success;
      if (this.success == 1) {
        refresher.complete();
        let userDeatil = this.responseData.users_details;
        for (let data1 of userDeatil) {
        }
      } else {
        this.message = this.responseData.message;
        refresher.complete();
        this.showToast(this.message);
      }
    }, (err) => {
      refresher.complete();
      console.log("Error", err);
    });
  }

我遵循了https://forum.ionicframework.com/t/ionic-4-refresher-is-not-passing-in-the-refresher-object-so-i-cant-complete-it/144213的指示

我尝试过:

@ViewChild("refresherRef") refresherRef: Refresher;

load(refresher: Refresher) {
    this.refresherRef.complete();
}    

但是它给了我@ViewChild("refresherRef")一个错误

期望2个参数,但得到1.ts(2554)core.d.ts(8436,47):没有提供'opts'的参数。

并且在Refresher在同一行@ViewChild("refresherRef") refresherRef: Refresher;

找不到名称“刷新器”。

angular ionic4 swiperefreshlayout pull-to-refresh
1个回答
0
投票

在Angular 8中,ViewChild需要2个参数

尝试替换

@ ViewChild(“ refresherRef”)

@@@@@@@@@@@@@@@@@@ torr.td.com(“静态:否”)

© www.soinside.com 2019 - 2024. All rights reserved.