Blame view

node_modules/mpvue-zanui/src/pages/counter/store.js 428 Bytes
ce4c83ff   wxy   初始提交
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  // https://vuex.vuejs.org/zh-cn/intro.html
  // make sure to call Vue.use(Vuex) if using a module system
  import Vue from 'vue'
  import Vuex from 'vuex'
  
  Vue.use(Vuex)
  
  const store = new Vuex.Store({
    state: {
      count: 0
    },
    mutations: {
      increment: (state) => {
        const obj = state
        obj.count += 1
      },
      decrement: (state) => {
        const obj = state
        obj.count -= 1
      }
    }
  })
  
  export default store