设备后退按钮 (platform.registerBackButtonAction) 不适用于应用程序后退按钮,也不适用于设备后退按钮。
有人能帮助我吗?
我该如何解决我的问题?
代码:-
ionViewDidLoad() {
this.navBar.backButtonClick = (e: UIEvent) => {
const alert = this.alertCtrl.create({
title: 'App termination',
message: 'Do you want to close the app?',
buttons: [{
text: 'Cancel',
role: 'cancel',
handler: () => {
console.log('Application exit prevented!');
}
}, {
text: 'Close App',
handler: () => {
this.platform.exitApp(); // Close this application
}
}]
});
alert.present();
}
}