2025-05-13 15:39:44 +08:00

38 lines
620 B
TypeScript

import { defineStore } from "pinia";
export const useDataStore = defineStore({
id: "data",
state: () => ({
data: {},
global: {},
file: {},
}),
getters: {
getData(): any {
return this.data;
},
getGlobal(): any {
return this.global;
},
getFile(): any {
return this.file;
},
},
actions: {
setData(data: any) {
this.data = data;
},
setGlobal(data: any) {
this.global = data;
},
setFile(data: any) {
this.file = data;
},
},
persist: {
enabled: true,
detached: true,
H5Storage: localStorage,
},
});