You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.0 KiB
36 lines
1.0 KiB
import Vue from 'vue';
|
|
import Vuex from 'vuex';
|
|
import messages from './messages/index';
|
|
import project from './project/index';
|
|
import role from './role/index';
|
|
import socket from './socket/index';
|
|
import task from './task/index';
|
|
import user from './user/index';
|
|
|
|
// 不属于具体模块的 应用级的 store内容
|
|
const state = {
|
|
networkConnected: true, // 网络是否连接
|
|
forceUseStorage: true, // 强制启用storage
|
|
};
|
|
|
|
const getters = {
|
|
// 是否启用本地存储
|
|
// 设置了强制启用本地存储 或者 没有网络连接的时候
|
|
useStorage({ networkConnected, forceUseStorage }) {
|
|
return forceUseStorage || !networkConnected;
|
|
},
|
|
};
|
|
|
|
const mutations = {
|
|
/**
|
|
* 设置网络是否连接的变量
|
|
* @param {*} state
|
|
* @param {boolean} networkConnected
|
|
*/
|
|
setNetworkConnected(state, networkConnected) {
|
|
state.networkConnected = networkConnected;
|
|
},
|
|
};
|
|
|
|
Vue.use(Vuex);
|
|
export default new Vuex.Store({ state, getters, mutations, modules: { user, messages, socket, project, role, task } });
|
|
|