vue-vben-admin/src/store/index.ts

21 lines
466 B
TypeScript
Raw Normal View History

2020-09-28 20:19:10 +08:00
import type { App } from 'vue';
2020-11-18 22:41:59 +08:00
import { createStore, createLogger, Plugin } from 'vuex';
2020-09-28 20:19:10 +08:00
import { config } from 'vuex-module-decorators';
import { isDevMode } from '/@/utils/env';
config.rawError = true;
const isDev = isDevMode();
2020-11-18 22:41:59 +08:00
const plugins: Plugin<any>[] = isDev ? [createLogger()] : [];
2020-09-28 20:19:10 +08:00
const store = createStore({
2020-11-18 22:41:59 +08:00
// modules: {},
2020-09-28 20:19:10 +08:00
strict: isDev,
2020-11-18 22:41:59 +08:00
plugins,
2020-09-28 20:19:10 +08:00
});
2020-10-30 21:32:05 +08:00
2020-09-28 20:19:10 +08:00
export function setupStore(app: App<Element>) {
app.use(store);
}
2020-10-30 21:32:05 +08:00
2020-09-28 20:19:10 +08:00
export default store;