feat: 添加 Pinia 状态管理并重构首页动画逻辑

- 添加 Pinia 作为状态管理工具,创建用户 store 管理登录状态
- 重构首页动画逻辑,使用 CSS sticky 替代 ScrollTrigger 实现更流畅的滚动效果
- 优化首屏加载和动画播放流程,修复热更新时的样式残留问题
- 添加演示用户数据并展示在页面属性中
This commit is contained in:
2026-04-26 20:39:14 +08:00
parent 3173bd3cd6
commit a22739aa7d
4 changed files with 155 additions and 78 deletions
+26
View File
@@ -0,0 +1,26 @@
import { computed, ref } from 'vue'
import { defineStore } from 'pinia'
export const useUserStore = defineStore('user', () => {
const id = ref('')
const displayName = ref('')
const role = ref('')
const locale = ref('zh-CN')
const isLoggedIn = computed(() => Boolean(id.value))
function loadDemoUser() {
id.value = 'demo-user'
displayName.value = 'Arctic Demo User'
role.value = 'Viewer'
}
return {
id,
displayName,
role,
locale,
isLoggedIn,
loadDemoUser,
}
})