定义全局loding
This commit is contained in:
19
src/stores/modules/overall.ts
Normal file
19
src/stores/modules/overall.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
// 每一个存储的模块,命名规则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
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user