store.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. default_tourist:'2',
  14. default_tourist_wpid:'CL_FDC',
  15. default_tourist_wpname:'崇礼风电场',
  16. memberData:'',
  17. initName:''
  18. },
  19. mutations: {
  20. copy(state,cont){
  21. //单一的改变某一个变量
  22. console.log(state)
  23. console.log(cont)
  24. state.memberData = cont;
  25. },
  26. change(state,contObj){
  27. //通过传入的变量去改变对应的全局变量
  28. let str = contObj.str;
  29. let cont = contObj.cont;
  30. state[str] = cont;
  31. },
  32. },
  33. actions:{
  34. copeFun:function(context,mData){
  35. context.commit('copy',mData)
  36. },
  37. changeFun:function(context,obj){
  38. context.commit('change',obj)
  39. }
  40. }
  41. })
  42. export default store