You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
579 B
30 lines
579 B
1 month ago
|
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()
|
||
|
})
|
||
|
},
|
||
|
},
|
||
|
})
|