我想使用ionic4中的设备后退按钮事件来执行某些操作,但是它不起作用。
export class AppComponent {
constructor(
private platform: Platform,
private splashScreen: SplashScreen,
private statusBar: StatusBar
) {
this.initializeApp();
this.backButtonEvent()
}
backButtonEvent() {
this.platform.backButton.subscribeWithPriority(2, () => {
console.log("clicked to the back button")
});
}
}
您可以像这样捕获硬件后退按钮事件
this.sub = this.platform.backButton.subscribeWithPriority(9999, () => {
// Do your stuff here
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句