答案是正确的,然而,它已经过时了.这是更新的答案.
链接到生命周期只需向下滚动,你应该看到它.
例:
ionViewWillEnter() {
console.log('Runs when the page is about to enter and become the active page.');
}
Run Code Online (Sandbox Code Playgroud)
只需在您要返回的视图中使用View Lifecycle Hook,例如:
onPageWillEnter() {
// You can execute what you want here and it will be executed right before you enter the view
}
Run Code Online (Sandbox Code Playgroud)
或者您在要离开的页面上使用生命周期钩子,然后用onPageWillLeave()替换onPageWillEnter()
随着离子β8,生命周期事件改变了他们的名字.查看官方离子博客,了解生命周期事件的完整列表.
| 归档时间: |
|
| 查看次数: |
8740 次 |
| 最近记录: |