Why Vuex

Vuex 术语

  • 调度一个动作:dispatch() action
  • 提交一个变异: commit() mutation

安装 Vuex

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

Vue.use(Vuex);

状态管理:Vuex.Store

const store = new Vuex.Store({
    state: {},
    mutations: {},
    actions: {},
    getters: {},
});
const root = new Vue({
    store,
});

END

posted @ 2020-04-09 21:00  develon  阅读(115)  评论(0编辑  收藏  举报