store.js
614 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import Vue from 'vue'
import Vuex from 'vuex'
import createLogger from 'vuex/dist/logger'
Vue.use(Vuex)
const state = {
orderNum: 0
}
const getters = {
getOrderNum: function (state) {
return state.orderNum
}
}
const mutations = {
changeOrderNum:function (state,str) {
state.orderNum = str
}
}
const actions = {
transferOrderTotal(context,obj){
context.commit('changeOrderNum',obj)
}
}
const debug = process.env.NODE_ENV !== 'production'
const store = new Vuex.Store({
state,
getters,
mutations,
actions,
plugins: debug ? [createLogger()] : []
})
export default store;