/**
 * 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 createPersistedState from 'vuex-persistedstate';

Vue.use(Vuex);

export default new Vuex.Store({
  state: {},
  mutations: {},
  actions: {},
  modules: {
    dict,
    user,
    theme
  },
  getters,
  plugins: [
    createPersistedState({
      key: 'vuex-mes',
      storage: window.sessionStorage,
      paths: ['user']
    })
  ] //会自动保存创建的状态。刷新还在
});
