ionic4 中的设备后退按钮事件不起作用
Device back button event in ionic4 not working
我想使用 ionic4 中的设备后退按钮事件来做一些事情,但它不起作用。
我的app.component.ts
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
});
我想使用 ionic4 中的设备后退按钮事件来做一些事情,但它不起作用。
我的app.component.ts
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
});