import Vue from 'vue'
import Vuex from 'vuex'
import getters from './getters'
import user from './modules/user'
Vue.use(Vuex)

const state = {
  submitDDTag: false,   //提交 - 防抖动 - 针对快速请求问题的拦截机制
  loading: false,   //全局 - 加载中....
  themeName: "light",
  login:false,
  z:"width:1%",
  y:"width:99%"
};
//改变状态的方法
const mutations = {
  openSubmitDDTag(state, tag) {
    state.submitDDTag = tag;
  },
  loadingStore(state, tag) {
    state.loading = tag;
  },
  changeTheme(state, tag) {
    state.themeName = tag;
  },
  changeZ(state, tag){
    state.z = tag;
  },
  changeY(state, tag){
    state.y = tag;
  },
  changelogin(state,tag){
    state.login = tag;
  }
};
var vuexStore = new Vuex.Store({
  modules: {
    user//调用this['user/login']()  引用 ...mapActions(['user/login']),
  },
  getters,
  state,
  mutations
});

export default vuexStore;