index.js 898 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import Vue from 'vue';
  2. import Vuex from 'vuex';
  3. Vue.use(Vuex);
  4. const store = new Vuex.Store({
  5. state:{ //全局访问对象
  6. szdata:{},
  7. dazhongdata:{},
  8. jinghuguoji:{}
  9. },
  10. getters: {
  11. getSzdata: state =>{
  12. return state.szdata
  13. } ,
  14. getDaZhongdata: state =>{
  15. return state.dazhongdata
  16. } ,
  17. getJinghuguoji:state=>{
  18. return state.jinghuguoji
  19. }
  20. },
  21. mutations: {
  22. setSzdata(state,value){
  23. state.szdata = value
  24. } ,
  25. setDaZhongdata(state,value){
  26. state.dazhongdata = value
  27. },
  28. setJinghuguoji(state,value){
  29. state.jinghuguoji = value
  30. }
  31. },
  32. actions:{
  33. }
  34. });
  35. export default store;