// plugins/auth-init.client.ts import { defineNuxtPlugin } from '#app' import { useAuthStore } from '~/stores/auth' export default defineNuxtPlugin(() => { // 客户端初始化时恢复认证状态 const authStore = useAuthStore() // 从Cookie恢复认证状态 authStore.initializeAuth() return { provide: { authInit: true } } })