Blame view

src/store/index.js 862 Bytes
22fb20b3   songchongxian   城市停车运营监控
1
2
  import Vue from 'vue'
  import Vuex from 'vuex'
a1bafdec   liuqimichale   vuex
3
4
  
  import createLogger from 'vuex/dist/logger'
22fb20b3   songchongxian   城市停车运营监控
5
6
7
  
  Vue.use(Vuex)
  
a1bafdec   liuqimichale   vuex
8
  const state = {
3b7be3b2   liuqimichale   今日订单数
9
10
    ParkingTotal: 0,
    orderTotal:0
a1bafdec   liuqimichale   vuex
11
12
13
14
15
  }
  
  const getters = {
    getParkingTotal: function (state) {
      return state.ParkingTotal
3b7be3b2   liuqimichale   今日订单数
16
17
18
    },
    getOrderTotal: function (state) {
      return state.orderTotal
a1bafdec   liuqimichale   vuex
19
20
21
22
23
24
    }
  }
  
  const mutations = {
    changeParkingTotal(state,str){
      state.ParkingTotal = str
3b7be3b2   liuqimichale   今日订单数
25
26
27
    },
    changeOrderTotal(state,str){
      state.orderTotal = str
a1bafdec   liuqimichale   vuex
28
29
30
31
32
33
34
    }
  
  }
  
  const actions = {
    transferParkingTotal(context,obj){
      context.commit('changeParkingTotal',obj)
3b7be3b2   liuqimichale   今日订单数
35
36
37
    },
    transferOrderTotal(context,obj){
      context.commit('changeOrderTotal',obj)
a1bafdec   liuqimichale   vuex
38
39
40
41
42
    }
  }
  
  
  const debug = process.env.NODE_ENV !== 'production'
22fb20b3   songchongxian   城市停车运营监控
43
  
a1bafdec   liuqimichale   vuex
44
45
46
47
48
49
  const store = new Vuex.Store({
    state,
    getters,
    mutations,
    actions,
    plugins: debug ? [createLogger()] : []
22fb20b3   songchongxian   城市停车运营监控
50
  })
a1bafdec   liuqimichale   vuex
51
  export  default  store;