1234567891011121314151617181920212223242526 |
- import type { App } from "vue";
- import { createPinia } from "pinia";
- import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
- const store = createPinia();
- store.use(piniaPluginPersistedstate);
- store.use(({ store }) => {
- const initialState = JSON.parse(JSON.stringify(store.$state));
- store.$reset = () => {
- store.$patch(initialState);
- };
- });
- // 全局注册 store
- export function setupStore(app: App<Element>) {
- app.use(store);
- }
- export * from "./modules/app";
- export * from "./modules/permission";
- export * from "./modules/settings";
- export * from "./modules/tagsView";
- export * from "./modules/user";
- export * from "./modules/common";
- export * from "./modules/dictionary";
- export { store };
|