// store/index.js
import Vuex from "vuex"
import Vue from "vue"
import $home from './home'
import createPersistedState from "vuex-persistedstate"
Vue.use(Vuex)
const store = new Vuex.Store({
modules: {
$home
},
plugins: [createPersistedState({
storage: window.sessionStorage,
reducer(val) {
console.log(val)
return {
home: val.$home,
}
}
})]
})
export default store
// main.js
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from "./store/index"
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')