feat: 把hello项目文件搬过来

This commit is contained in:
菲鸽
2024-02-04 16:00:27 +08:00
parent 16694caccd
commit b90a409737
45 changed files with 2398 additions and 11 deletions

View File

@@ -1,24 +1,30 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
import { UserInfo } from '../typings'
import { IUserInfo } from '../typings'
const initState = { nickname: '', avatar: '' }
export const useUserStore = defineStore(
'user',
() => {
const userInfo = ref<UserInfo>({ nickname: '', avatar: '' })
const userInfo = ref<IUserInfo>({ ...initState })
const setUserInfo = (val: UserInfo) => {
const setUserInfo = (val: IUserInfo) => {
userInfo.value = val
}
const clearUserInfo = () => {
userInfo.value = undefined
}
const reset = () => {
userInfo.value = { ...initState }
}
return {
userInfo,
setUserInfo,
clearUserInfo,
reset,
}
},
{