【发布时间】:2020-06-21 03:41:33
【问题描述】:
在尝试完成复习时,我收到了错误
TypeError: refresher.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);
});
}
我试过了:
@ViewChild("refresherRef") refresherRef: Refresher;
load(refresher: Refresher) {
this.refresherRef.complete();
}
但它在@ViewChild("refresherRef") 处给了我一个错误
预期 2 个参数,但得到 1.ts(2554) core.d.ts(8436, 47): An 未提供“选择”的参数。
在 Refresher 在同一行 @ViewChild("refresherRef") refresherRef: Refresher;
找不到名称“Refresher”。
【问题讨论】:
标签: angular ionic4 swiperefreshlayout pull-to-refresh