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++
    }
  }
})

  

猜你喜欢

转载自www.cnblogs.com/xuqp/p/9204100.html