/**
 * vuex状态管理
 */
import Vue from 'vue';
import Vuex from 'vuex';
import getters from './getters';
import dict from './modules/dict';
import user from './modules/user';
import theme from './modules/theme';
import paramsSetData from '@/store/modules/paramsSetData';
import createPersistedState from 'vuex-persistedstate';
import createQiankunActionsPlugin from './plugins/createQiankunActionsPlugin';
Vue.use(Vuex);

export default new Vuex.Store({
  state: {},
  mutations: {},
  actions: {},
  modules: {
    dict,
    user,
    paramsSetData,
    theme
  },
  getters,
  plugins: [
    createPersistedState({
      key: 'pVuex',
      storage: window.sessionStorage,
      paths: ['user', 'paramsSetData']
    }),
    createQiankunActionsPlugin()
  ] //会自动保存创建的状态。刷新还在
});
// import { initGlobalState, MicroAppStateActions } from 'qiankun';
// const actions = initGlobalState({ a: 2 });
