【发布时间】:2017-11-14 03:38:13
【问题描述】:
根据 Ionic 3 文档,这应该可以工作:
ionViewWillLeave(): boolean {
if (this.cantLeave) {
let alert = this.alertCtrl.create({
title: 'You can\'t leave',
subTitle: 'You stay and work.',
buttons: ['Oh sorry']
});
alert.present();
}
return this.cantLeave;
}
但事实并非如此。出现警报,但页面仍然发生变化。但是这里它说return true 或return false 将告诉Ionic 继续页面更改或停止它。
http://ionicframework.com/docs/api/navigation/NavController/
我做错了什么?
【问题讨论】:
标签: cordova ionic-framework ionic3