Ok ..我注意到每次在导航控制器中推送新页面时,页面都会呈现页面状态始终是默认值。 让我们说用户去一个页面,修改一些数据,然后回到页面,他的更改都消失了。 有没有办法可以恢复页面,以防他已经在那里? 这是我现在的想法,我想知道是否有更好的方法?
//Check if page was not visited already
console.log('Check if page was not already loaded.')
let restoredFromHistory = false;
this.navCtrl.getViews().forEach( view => {
if(view.name == 'CartPage'){
console.log('Page was found in the history.')
this.navCtrl.push(view);
restoredFromHistory = true;
}
})
if(!restoredFromHistory){
console.log('Page was not found in the history. Pushing a brand new.')
this.navCtrl.push(CartPage)
}