kun-galgame-vue/src/layout/KUNGalgameAPP.vue
2023-06-07 15:17:56 +08:00

49 lines
1.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<script setup lang="ts">
import 'animate.css'
import { onBeforeMount } from 'vue'
// 导入设置面板 store
import { useKUNGalgameSettingsStore } from '@/store/modules/settings'
import { storeToRefs } from 'pinia'
// 使用设置面板的 store
const settingsStore = useKUNGalgameSettingsStore()
const { showKUNGalgameMode } = storeToRefs(settingsStore)
// 必须在这里调用生命周期函数,初始化主题
onBeforeMount(() => {
const theme = showKUNGalgameMode.value
// 恢复保存的主题状态
if (theme) {
document.documentElement.className = theme
}
})
import { currBackground } from '@/hooks/useBackgroundPicture'
</script>
<template>
<!-- #default v-slot 的简写route 就是路由Component 是一个 v-node -->
<div class="app" :style="{ backgroundImage: currBackground }">
<!-- <RouterView /> -->
<RouterView #default="{ route, Component }">
<transition
:enter-active-class="`animate__animated ${route.meta.transition}`"
>
<component :is="Component"></component>
</transition>
</RouterView>
</div>
</template>
<style lang="scss" scoped>
.app {
background-repeat: no-repeat;
background-position: center;
background-size: cover;
background-attachment: fixed;
background-color: var(--kungalgame-white);
min-width: 900px;
}
</style>