create-base
Version:
快速构建项目基础框架,支持vue/uni-app/后台管理模板等
20 lines (17 loc) • 354 B
text/typescript
import type { UserRow } from '@/types/user'
interface UserState {
token: string
profile: UserRow
}
export const useUserStore = defineStore('user', {
state: (): UserState => ({
token: uni.getStorageSync('token'),
profile: {} as UserRow
}),
actions: {
clear() {
uni.removeStorageSync('token')
this.$reset()
}
}
})