| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import { createStore } 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'
- const store = createStore({
- 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
|