<template>
    <vant-config-provider :theme="dark ? 'dark' : 'light'">
        <ion-app>
            <ion-router-outlet />
        </ion-app>
    </vant-config-provider>
</template>

<script setup>
import { useDark } from '@vueuse/core'
import { ConfigProvider as VantConfigProvider } from 'vant'
import { useBackButton, useIonRouter } from '@ionic/vue'
import { App } from '@capacitor/app'

const dark = useDark()
const ionRouter = useIonRouter()
useBackButton(-1, () => {
    if (!ionRouter.canGoBack()) {
        App.exitApp()
    }
})
</script>
