// 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 counterModule = {
  state: {
    count: 0
  },
  mutations: {
    increment: (state) => {
      const obj = state
      obj.count += 1
    },
    decrement: (state) => {
      const obj = state
      obj.count -= 1
    }
  }
}

const logsModule = {
  state: {
    path: ''
  },
  mutations: {
    setImage (state, payload) {
      state.path = payload
    }
  }
}
const indexModule = {
  state: {
    config: {}
  },
  mutations: {
    setConfig (state, payload) {
      state.config = payload
    }
  }
}
const store = new Vuex.Store({
  modules: {
    counterPage: counterModule,
    logPage: logsModule,
    indexPage: indexModule
  }
})

export default store
