index.js 680 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import Vue from 'vue'
  2. import Vuex from 'vuex'
  3. // 各个模块
  4. import editor from './modules/editor'
  5. import user from './modules/user'
  6. import { Message } from 'element-ui'
  7. /**
  8. * 全局状态管理
  9. */
  10. const state = {
  11. };
  12. const actions = {
  13. /**
  14. * 显示提示 msg.type 类型 msg.data 消息内容
  15. * @param commit
  16. * @param msg
  17. */
  18. showMassage(store, msg) {
  19. console.log(msg)
  20. Message({
  21. type: msg.type,
  22. message: msg.message || msg.data
  23. })
  24. },
  25. };
  26. const mutations = {};
  27. const getters = {};
  28. if (process.env.NODE_DEV !== 'production') {
  29. Vue.use(Vuex)
  30. }
  31. export default new Vuex.Store({
  32. state,
  33. getters,
  34. actions,
  35. mutations,
  36. modules: {
  37. editor,
  38. user
  39. }
  40. });