Files
Code-Create/src/stores/userInfo.ts
2026-05-18 15:22:08 +08:00

31 lines
508 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 每一个存储的模块命名规则use开头store结尾
import { defineStore } from 'pinia'
import { ref, computed } from 'vue'
export const useUserInfoStore = defineStore('userInfo', () => {
const state = ref({
userInfo: {},
token: '',
})
// actions
const setUserInfo = (data: any) => {
state.value.userInfo = data
}
const setToken = (data: string) => {
state.value.token = data
}
const logOut = async () => {
}
return {
state,
setToken,
setUserInfo,
logOut,
}
})