| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- import Vue from 'vue'
- import Vuex from 'vuex'
- import app from "./modules/app"
- import user from "./modules/user"
- import dict from "./modules/dict"
- import follow from "./modules/follow"
- import call from "./modules/call.js"
- import getters from "./getters";
- import createPersistedState from 'vuex-persistedstate'
- import {
- localStorage
- } from 'mp-storage'
- Vue.use(Vuex)
- const store = new Vuex.Store({
- modules: {
- app,
- user,
- dict,
- follow,
- call
- },
- getters,
- state: {
- hasLogin: false,
- },
- mutations: {},
- actions: {
- },
- plugins: [
- createPersistedState({
- storage: localStorage,
- paths: ['user'],
- reducer: function(state) {
- return {
- user: {
- // 只保存 user 中除了 netConfig 以外的其他属性
- ...state.user,
- netConfig: undefined // 显式排除 netConfig
- }
- }
- }
- })
- ],
- })
- export default store
|