Fix:Native back button go back or ask before quitting #52, Fix:Appbar back button

This commit is contained in:
advplyr 2021-12-10 16:31:54 -06:00
parent 6c08e91dfc
commit d3a2c79a55
8 changed files with 42 additions and 7 deletions

View file

@ -1,6 +1,23 @@
import Vue from 'vue'
import { App } from '@capacitor/app'
import { Dialog } from '@capacitor/dialog'
import { formatDistance, format } from 'date-fns'
App.addListener('backButton', async ({ canGoBack }) => {
if (!canGoBack) {
const { value } = await Dialog.confirm({
title: 'Confirm',
message: `Did you want to exit the app?`,
})
if (value) {
App.exitApp()
}
} else {
window.history.back()
}
});
Vue.prototype.$eventBus = new Vue()
Vue.prototype.$isDev = process.env.NODE_ENV !== 'production'