mirror of
https://github.com/setube/ogame-vue-ts.git
synced 2026-05-12 16:05:12 +08:00
feat(ui): 添加页面切换动画和星空背景效果
- 使用 Transition 组件实现页面切换的淡入淡出动画 - 根据路由路径设置组件 key 值以触发过渡效果 - 在暗色模式下添加 StarsBackground 星空背景组件 - 为 RouterView 和 StarsBackground 设置高度样式 - 引入 StarsBackground 组件并注册使用
This commit is contained in:
20
src/App.vue
20
src/App.vue
@@ -319,9 +319,22 @@
|
|||||||
|
|
||||||
<!-- 内容区域 -->
|
<!-- 内容区域 -->
|
||||||
<main class="flex-1 overflow-y-auto">
|
<main class="flex-1 overflow-y-auto">
|
||||||
<div class="animate-fade-in">
|
<Transition name="page" mode="out-in">
|
||||||
<RouterView />
|
<div key=$route.fullPath class="h-full">
|
||||||
</div>
|
<StarsBackground
|
||||||
|
v-if="isDark"
|
||||||
|
:factor="0.05"
|
||||||
|
:speed="50"
|
||||||
|
star-color="#fff"
|
||||||
|
class="h-full"
|
||||||
|
>
|
||||||
|
<RouterView class="h-full" />
|
||||||
|
</StarsBackground>
|
||||||
|
<div v-else class="h-full">
|
||||||
|
<RouterView class="h-full" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Transition>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</SidebarInset>
|
</SidebarInset>
|
||||||
@@ -444,6 +457,7 @@
|
|||||||
import { toast } from 'vue-sonner'
|
import { toast } from 'vue-sonner'
|
||||||
import { migrateGameData } from '@/utils/migration'
|
import { migrateGameData } from '@/utils/migration'
|
||||||
import { checkLatestVersion } from '@/utils/versionCheck'
|
import { checkLatestVersion } from '@/utils/versionCheck'
|
||||||
|
import {StarsBackground} from "@/components/ui/bg-stars";
|
||||||
|
|
||||||
// 执行数据迁移(在 store 初始化之前)
|
// 执行数据迁移(在 store 初始化之前)
|
||||||
migrateGameData()
|
migrateGameData()
|
||||||
|
|||||||
Reference in New Issue
Block a user