主要应用插件vuex-persistedstate

import Vue from "vue";
import Vuex from "vuex";
import storeSidebar from "./storeSidebar";
import storeConsole from "./storeConsole";
import storeLogin from "./storeLogin";
import storeUrl from "./storeUrl";
import storeUserFliters from "./storeUserFliters";
import storeRoleFliters from "./storeRoleFliters";
import storeUser from "./storeUser";
import storeRole from "./storeRole";
import storeWidget from "./storeWidget";
import storeOrgan from "./storeOrgan";
import storeUserImage from "./storeUserImage";
import CreatePersistedState from "vuex-persistedstate";
Vue.use(Vuex);

export default new Vuex.Store({
  state: {},
  mutations: {},
  actions: {},
  modules: {
    storeSidebar,
    storeConsole,
    storeLogin,
    storeUrl,
    storeUserFliters,
    storeUser,
    storeWidget,
    storeRoleFliters,
    storeRole,
    storeOrgan,
    storeUserImage
  },
  plugins: [
    CreatePersistedState({
      reducer(val) {
        return {
          assessmentData: val.storeLogin,
          storeSidebar: val.storeSidebar,
          storeUserImage: {
            userImage: val.storeUserImage.userImage
          },
          storeUrl: {
            url: val.storeUrl.url,
            MenuList: val.storeUrl.MenuList,
            RelationList: val.storeUrl.RelationList,
            appList: val.storeUrl.appList
          }
        };
      }
    })
  ]
});

娜娜
33 声望6 粉丝

前端工程师一枚