vuex使用 store.js

2019-03-28 15:46:32 浏览数 (1)

store.js 状态汇总文件 暴露

代码语言:javascript复制
import Vue        from 'vue'
import Vuex       from 'vuex'
import createPersistedState  from 'vuex-persistedstate' //存储插件
import actions    from './store/actions'
import mutations  from './store/mutations'
import state      from './store/state'
import meModule from './store/me_module'

Vue.use(Vuex)

const getters = {

}


const store = new Vuex.Store({
  state : {
    ...state
  },
  mutations : {
    ...mutations
  },
  actions : {
    ...actions
  },
  getters,
  modules:{
    me:meModule
  },
  plugins:[createPersistedState({ storage: window.sessionStorage })]
})

export default store;

0 人点赞