简体   繁体   English

如何处理 ionic3 中的页面刷新 (ctrl+R, F5)

[英]How to handle Refresh of a page (ctrl+R, F5) in ionic3

Let's say I have page1 and page2 in an angular application.假设我在 angular 应用程序中有 page1 和 page2。 From page1 I go to page2 by passing some parameters, ie.通过传递一些参数,从 page1 I go 到 page2,即。

given: navCtrl: NavController
this.nav.push(Page2, {id: 23});

and then in the constructor of page2:然后在page2的构造函数中:

given: navParams: NavParams
this.id = this.navParams.get('id');

If I refresh the page with ctrl+R or F5 then this.navParams.get('id') doens't have anything...it's null.如果我用 ctrl+R 或 F5 刷新页面,那么 this.navParams.get('id') 什么都没有……它是 null。

Is there anyway to cache parameters?反正有缓存参数吗?

Thanks谢谢

You can cache your data using either the ionic native storage plugin https://ionicframework.com/docs/native/native-storage or sqlite https://ionicframework.com/docs/building/storage您可以使用离子本机存储插件https://ionicframework.com/docs/native/native-storage或 sqlite Z5E056C500A1C4B6A71110B50D807BADE5缓存数据。

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

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