import { defineStore } from 'pinia' import { ref, computed } from 'vue' //用户相关的状态管理 export const useUserStore = defineStore('user', () => { // State const schoolLogo = ref('') // 如果需要管理 userInfo,也可以放在这里,但通常 userInfo 存在 localStorage 中 // 这里我们主要解决 header.vue 中用到的 schoolLogo // Getters (可选,如果需要计算属性) const hasLogo = computed(() => !!schoolLogo.value) // Actions function setSchoolLogo(logo: string) { schoolLogo.value = logo } function clearUserState() { schoolLogo.value = '' // 清除其他用户相关状态 } return { schoolLogo, hasLogo, setSchoolLogo, clearUserState } })