【发布时间】:2016-09-19 17:13:28
【问题描述】:
当按下返回按钮时,如何重新加载位于<ion-content> 标签下的内容?
【问题讨论】:
当按下返回按钮时,如何重新加载位于<ion-content> 标签下的内容?
【问题讨论】:
那里的答案是正确的,但是已经过时了。这是更新的答案。
指向Life Cycle 的链接只需向下滚动即可看到。
例子:
ionViewWillEnter() {
console.log('Runs when the page is about to enter and become the active page.');
}
【讨论】:
Ionic 4。
只需在要返回的视图中使用View Lifecycle Hook,例如:
onPageWillEnter() {
// You can execute what you want here and it will be executed right before you enter the view
}
或者您在要离开的页面上使用生命周期挂钩,然后将 onPageWillEnter() 替换为 onPageWillLeave()
在 ionic beta 8 中,生命周期事件更改了名称。查看official ionic blog 获取生命周期事件的完整列表。
【讨论】: