30 lines
579 B
30 lines
579 B
import { defineStore } from 'pinia'
|
|
|
|
interface CountState {
|
|
count1: number
|
|
userId: any
|
|
nickName: string
|
|
}
|
|
|
|
export const countStore = defineStore(
|
|
'count-store',
|
|
{
|
|
state: (): CountState => ({
|
|
count1: 10,
|
|
userId: null,
|
|
nickName: '',
|
|
}),
|
|
actions: {
|
|
randomizeCounter(count: number) {
|
|
this.count1 = count
|
|
},
|
|
setNameAId(userId: any, nickName: string) {
|
|
return new Promise<void>((resolve) => {
|
|
this.userId = userId
|
|
this.nickName = nickName
|
|
resolve()
|
|
})
|
|
},
|
|
},
|
|
})
|