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.
40 lines
580 B
40 lines
580 B
4 years ago
|
import Vue from 'vue'
|
||
|
import Vuex from 'vuex'
|
||
|
|
||
|
Vue.use(Vuex)
|
||
|
|
||
|
const store = new Vuex.Store({
|
||
|
state: {
|
||
|
/**
|
||
|
* 是否需要强制登录
|
||
|
*/
|
||
|
forcedLogin: false,
|
||
|
hasLogin: false,
|
||
|
userName: ""
|
||
|
},
|
||
|
modules: {
|
||
|
user,
|
||
|
temp,
|
||
|
base,
|
||
|
waybill,
|
||
|
location,
|
||
|
contract
|
||
|
},
|
||
|
getters,
|
||
|
plugins: [createPersistedState({
|
||
|
storage: window.sessionStorage
|
||
|
})],
|
||
|
mutations: {
|
||
|
login(state, userName) {
|
||
|
state.userName = userName || '新用户';
|
||
|
state.hasLogin = true;
|
||
|
},
|
||
|
logout(state) {
|
||
|
state.userName = "";
|
||
|
state.hasLogin = false;
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
|
||
|
export default store
|