a22739aa7d
- 添加 Pinia 作为状态管理工具,创建用户 store 管理登录状态 - 重构首页动画逻辑,使用 CSS sticky 替代 ScrollTrigger 实现更流畅的滚动效果 - 优化首屏加载和动画播放流程,修复热更新时的样式残留问题 - 添加演示用户数据并展示在页面属性中
27 lines
518 B
TypeScript
27 lines
518 B
TypeScript
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,
|
|
}
|
|
})
|