38 lines
633 B
TypeScript
38 lines
633 B
TypeScript
import { defineStore } from 'pinia'
|
|||
|
|
import { ref } from 'vue'
|
||
|
|
|
||
|
|
/** 账户信息 */
|
||
|
|
export interface AccountState {
|
||
|
|
/** 账户ID */
|
||
|
|
id: string
|
||
|
|
/** 用户名 */
|
||
|
|
username: string
|
||
|
|
/** 年龄 */
|
||
|
|
age?: number
|
||
|
|
/** 性别 */
|
||
|
|
sex?: string
|
||
|
|
/** 手机号 */
|
||
|
|
phone?: string
|
||
|
|
/** 邮箱 */
|
||
|
|
email?: string
|
||
|
|
/** 头像 */
|
||
|
|
avatar?: string
|
||
|
|
/** 生日 */
|
||
|
|
birthday?: string
|
||
|
|
}
|
||
|
|
|
||
|
|
export const useAccountStore = defineStore(
|
||
|
|
'account',
|
||
|
|
() => {
|
||
|
|
const accountInfo = ref<AccountState>()
|
||
|
|
const token = ref('')
|
||
|
|
|
||
|
|
return { accountInfo, token }
|
||
|
|
},
|
||
|
|
{
|
||
|
|
persist: {
|
||
|
|
pick: ['accountInfo', 'token']
|
||
|
|
}
|
||
|
|
}
|
||
|
|
)
|