kun-galgame-vue/src/App.vue

51 lines
1.2 KiB
Vue
Raw Normal View History

2023-04-20 12:01:38 +00:00
<!-- App -->
2023-06-14 14:51:50 +00:00
<script setup lang="ts">
2023-10-23 10:34:28 +00:00
import { defineAsyncComponent, onBeforeMount } from 'vue'
// Import notification and alert components
2023-06-16 02:15:47 +00:00
import Alert from '@/components/alert/Alert.vue'
import Info from '@/components/alert/Info.vue'
2023-06-15 14:11:55 +00:00
2023-10-23 10:34:28 +00:00
// Import human verification component
2023-09-24 07:30:42 +00:00
const Capture = defineAsyncComponent(
() => import('@/components/capture/Capture.vue')
)
2023-10-23 10:34:28 +00:00
import { useKUNGalgameSettingsStore } from '@/store/modules/settings'
import { storeToRefs } from 'pinia'
// Use the settings panel store
2023-09-24 13:46:04 +00:00
const { showKUNGalgameMode, showKUNGalgameFontStyle } = storeToRefs(
useKUNGalgameSettingsStore()
)
2023-06-14 14:51:50 +00:00
2023-10-23 10:34:28 +00:00
// Lifecycle functions must be called here to initialize the theme and font
2023-06-14 14:51:50 +00:00
onBeforeMount(() => {
const theme = showKUNGalgameMode.value
2023-09-10 10:49:47 +00:00
const font = showKUNGalgameFontStyle.value
2023-06-14 14:51:50 +00:00
2023-10-23 10:34:28 +00:00
// restore saved theme status
2023-06-14 14:51:50 +00:00
if (theme) {
document.documentElement.className = theme
}
2023-10-23 10:34:28 +00:00
// restore saved font settings
2023-09-10 10:49:47 +00:00
if (font) {
document.documentElement.style.fontFamily = font
}
2023-06-14 14:51:50 +00:00
})
</script>
2023-04-14 13:58:13 +00:00
<template>
2023-10-23 10:34:28 +00:00
<!-- Global alert component -->
2023-06-15 14:11:55 +00:00
<Alert />
2023-10-23 10:34:28 +00:00
<!-- Global info component -->
2023-06-15 14:11:55 +00:00
<Info />
2023-09-24 07:30:42 +00:00
2023-10-23 10:34:28 +00:00
<!-- Global capture component -->
2023-09-24 07:30:42 +00:00
<Capture />
2023-10-23 10:34:28 +00:00
2023-05-02 09:44:23 +00:00
<RouterView />
2023-04-14 13:58:13 +00:00
</template>
2023-10-19 17:45:29 +00:00
<style lang="scss" scoped></style>