fix
This commit is contained in:
26
src/stores/modules/userInfo.ts
Normal file
26
src/stores/modules/userInfo.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
// 每一个存储的模块,命名规则use开头,store结尾
|
||||
import { defineStore } from 'pinia'
|
||||
export const useUserInfoStore = defineStore({
|
||||
id: 'userInfo', // 必须指明唯一的pinia仓库的id
|
||||
state: () => {
|
||||
return {
|
||||
num: 0,
|
||||
name: '张三',
|
||||
token: ''
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
doubleCount: (state) => state.num * 2
|
||||
},
|
||||
actions: {
|
||||
changeNum() {
|
||||
this.num++
|
||||
},
|
||||
loginOut() {
|
||||
// 处理退出登录的一些逻辑
|
||||
return new Promise((rez) => {
|
||||
rez('111')
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
31
src/stores/modules/workshop.ts
Normal file
31
src/stores/modules/workshop.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
// 每一个存储的模块,命名规则use开头,store结尾
|
||||
import { defineStore } from 'pinia'
|
||||
export const useWorkshopStore = defineStore({
|
||||
id: 'workshop', // 必须指明唯一的pinia仓库的id
|
||||
state: () => {
|
||||
return {
|
||||
userData:{
|
||||
title: '123123',
|
||||
name: '123123',
|
||||
describe: '',
|
||||
id:'',
|
||||
},
|
||||
queryList:[]
|
||||
}
|
||||
},
|
||||
getters: {
|
||||
// doubleCount: (state) => state.num * 2
|
||||
},
|
||||
actions: {
|
||||
setLogin(data:any) {
|
||||
this.userData.title= data.title
|
||||
this.userData.name= data.name
|
||||
this.userData.describe= data.describe
|
||||
this.userData.id= data.id
|
||||
console.log(this.userData)
|
||||
},
|
||||
setQueryList(list:any) {
|
||||
this.queryList = list
|
||||
},
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user