12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- import Vue from 'vue'
- import Vuex from 'vuex'
- // 各个模块
- import editor from './modules/editor'
- import user from './modules/user'
- import { Message } from 'element-ui'
- /**
- * 全局状态管理
- */
- const state = {
- };
- const actions = {
- /**
- * 显示提示 msg.type 类型 msg.data 消息内容
- * @param commit
- * @param msg
- */
- showMassage(store, msg) {
- console.log(msg)
- Message({
- type: msg.type,
- message: msg.message || msg.data
- })
- },
- };
- const mutations = {};
- const getters = {};
- if (process.env.NODE_DEV !== 'production') {
- Vue.use(Vuex)
- }
- export default new Vuex.Store({
- state,
- getters,
- actions,
- mutations,
- modules: {
- editor,
- user
- }
- });
|