Files
urldb/web/plugins/auth.client.ts

12 lines
301 B
TypeScript
Raw Normal View History

2025-07-10 21:14:17 +08:00
export default defineNuxtPlugin(() => {
2025-07-30 17:33:36 +08:00
// 只在客户端执行
if (process.client) {
const userStore = useUserStore()
// 在应用启动时初始化用户认证状态
// 使用 nextTick 确保在 DOM 更新后执行
nextTick(() => {
userStore.initAuth()
})
}
2025-07-10 21:14:17 +08:00
})