20 lines
416 B
TypeScript
20 lines
416 B
TypeScript
|
|
// 每一个存储的模块,命名规则use开头,store结尾
|
|||
|
|
import { defineStore } from 'pinia'
|
|||
|
|
export const useOverallStore = defineStore({
|
|||
|
|
id: 'overall', // 必须指明唯一的pinia仓库的id
|
|||
|
|
state: () => {
|
|||
|
|
return {
|
|||
|
|
loading:false,
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
getters: {
|
|||
|
|
// doubleCount: (state) => state.num * 2
|
|||
|
|
},
|
|||
|
|
actions: {
|
|||
|
|
// 全局loading
|
|||
|
|
setLoading(data:boolean){
|
|||
|
|
this.loading = data
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|