kun-galgame-vue/src/App.vue

52 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-09-24 07:30:42 +00:00
import { defineAsyncComponent } from 'vue'
2023-06-15 14:11:55 +00:00
// 导入通知和提示组件
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-06-14 14:51:50 +00:00
import { onBeforeMount } from 'vue'
// 导入设置面板 store
import { useKUNGalgameSettingsStore } from '@/store/modules/settings'
import { storeToRefs } from 'pinia'
2023-09-24 07:30:42 +00:00
// 导入人机验证组件
const Capture = defineAsyncComponent(
() => import('@/components/capture/Capture.vue')
)
2023-06-14 14:51:50 +00:00
// 使用设置面板的 store
2023-09-24 13:46:04 +00:00
const { showKUNGalgameMode, showKUNGalgameFontStyle } = storeToRefs(
useKUNGalgameSettingsStore()
)
2023-06-14 14:51:50 +00:00
2023-09-10 10:49:47 +00:00
// 必须在这里调用生命周期函数,初始化主题和字体
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
// 恢复保存的主题状态
if (theme) {
document.documentElement.className = theme
}
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-06-15 14:11:55 +00:00
<!-- 全局警告组件 -->
<Alert />
<!-- 全局通知组件 -->
<Info />
2023-09-24 07:30:42 +00:00
<!-- 人机验证组件 -->
<Capture />
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>