store.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import Vue from 'vue'
  2. import Vuex from 'vuex'
  3. Vue.use(Vuex)
  4. const store = new Vuex.Store({
  5. state: {
  6. wholeSituationBackStageIp:'117.78.18.24',
  7. wholeSituationBackStagePort:'9988',
  8. windpowerstationNameToId:{
  9. "宁夏新能源公司":"0","麻黄山风电场":"MHS_FDC","牛首山风电场":"NSS_FDC","青山风电场":"SBQ_FDC","石板泉风电场":"QS_FDC","香山风电场":"QS_FDC"
  10. },
  11. default_wpid:'0',
  12. default_wpname:'河北能源集团',
  13. memberData:'',
  14. initName:''
  15. },
  16. mutations: {
  17. copy(state,cont){
  18. //单一的改变某一个变量
  19. console.log(state)
  20. console.log(cont)
  21. state.memberData = cont;
  22. },
  23. change(state,contObj){
  24. //通过传入的变量去改变对应的全局变量
  25. let str = contObj.str;
  26. let cont = contObj.cont;
  27. state[str] = cont;
  28. },
  29. },
  30. actions:{
  31. copeFun:function(context,mData){
  32. context.commit('copy',mData)
  33. },
  34. changeFun:function(context,obj){
  35. context.commit('change',obj)
  36. }
  37. }
  38. })
  39. export default store