angular - 在 Ionic3 中下拉刷新时出错
问题描述
嘿,我正在尝试通过下拉 ionic 来刷新我的产品列表。第一次工作,但之后它给出了这个错误
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;
});
});
检查这个。
推荐阅读
- git - 我如何处理 Git lfs 问题
- c# - InsertAndGetIdAsync - 无法为标识列插入显式值
- c# - 如何在 .net 核心中运行使用依赖注入的非静态代码
- jenkins - terraform fmt 在 Jenkins 管道中失败
- swift - 为什么 NSImage.Name 存在?
- autosar - AUTOSAR:检测模型中的二维数组
- c# - 如何在不使用静态注册表的情况下配置 BsonSerializer?
- ios - 不推荐使用的应用程序:openURL 方法 - iOS
- javascript - 将 Javascript 变量中的 URL 读入 HTML
- javafx - JavaFx- 根据输入动态克隆选项卡