简体   繁体   English

离子中的离子刷新错误

[英]ion-refresher bug in ionic

I have an ion-refresher in 5 pages of my application我在我的应用程序的 5 页中有一个离子刷新器

  <ion-refresher slot="fixed" (ionRefresh)="refreshActions($event)">
    <ion-refresher-content pulling-icon="null" refreshing-spinner="null">
      <ion-spinner name="crescent"></ion-spinner>
    </ion-refresher-content>
  </ion-refresher>

when im pulling down this refresh, it calls this method当我拉下这个刷新时,它会调用这个方法

  refreshActions($event) {
    this.subscription$.forEach(subscription => subscription.unsubscribe());
    this.loadFavoritesAssets(this.userId);
    setTimeout(() => {
      $event.target.complete();
    }, 500);
  }

this method unsubscribe from all subscriptions and reload the HTTP Request to call the new information in database, this works well此方法取消订阅所有订阅并重新加载 HTTP 请求以调用数据库中的新信息,效果很好

but when i navigate to another page, and try to call the other ion-refresher, the refresher doenst pull and doenst refresh the page, it gets stucks by the other page refresher.但是当我导航到另一个页面并尝试调用另一个离子刷新器时,刷新器不会拉动并刷新页面,它会被另一个页面刷新器卡住。

then i need to get back to the previous page and scroll the screen or make some move to "complete" the refresh, after that i can refresh the other page.然后我需要返回上一页并滚动屏幕或进行一些移动以“完成”刷新,之后我可以刷新其他页面。

Anyone knows what is this ?有谁知道这是什么? I dont undestand this behavior, it has something with the http request refresh method ?我不理解这种行为,它与 http 请求刷新方法有关吗? I'm calling the complete() method in the wrong way ?我以错误的方式调用了 complete() 方法?

And when i refresh the page and navigate to another page quickly, this behavior always happen当我刷新页面并快速导航到另一个页面时,这种行为总是发生

just remove this line from your above code and check只需从上面的代码中删除这一行并检查

this.subscription$.forEach(subscription => subscription.unsubscribe()); this.subscription$.forEach(subscription => subscription.unsubscribe());

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

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