I wonna show confirmation dialog before user will quit app.
I found this instruction in the docs
import { useBackButton, useIonRouter } from '@ionic/vue';
import { Plugins } from '@capacitor/core';
const { App } = Plugins;
...
export default {
setup() {
const ionRouter = useIonRouter();
useBackButton(-1, () => {
if (!ionRouter.canGoBack()) {
App.exitApp();
}
});
}
}
How I can call custom function from methods section?
...
if (!ionRouter.canGoBack()) {
this.doExitApp();
}
...
Android Studio show error
Msg: TypeError: Cannot read property 'doExitApp' of undefined
Link on the doc
https://ionic-docs.herokuapp.com/docs/fr/developing/hardware-back-button