vuex使用

vuex是状态管理模式

import Vue from 'vue';
import Vuex from 'vuex';

// Make sure to call Vue.use(Vuex) first if using a module system
Vue.use(Vuex);
const store = new Vuex.Store({
  state: {
    count: 0
  },
  mutations: {
    increment (state) {
      state.count++
    }
  }
})

  

posted @ 2018-06-20 15:37  FeelRose  阅读(160)  评论(0编辑  收藏  举报