2023-04-20 12:01:38 +00:00
|
|
|
<!-- App -->
|
2023-06-14 14:51:50 +00:00
|
|
|
<script setup lang="ts">
|
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'
|
|
|
|
|
|
|
|
// 使用设置面板的 store
|
|
|
|
const settingsStore = useKUNGalgameSettingsStore()
|
2023-09-10 10:49:47 +00:00
|
|
|
const { showKUNGalgameMode, showKUNGalgameFontStyle } =
|
|
|
|
storeToRefs(settingsStore)
|
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-05-02 09:44:23 +00:00
|
|
|
<RouterView />
|
2023-04-14 13:58:13 +00:00
|
|
|
</template>
|
|
|
|
|
2023-04-18 08:04:47 +00:00
|
|
|
<style scoped></style>
|