1 ?怎么使用vuex
? ? ? ? 安裝等等 ?然后下載vuex模板 store文件 ?里面包含 state.js action.js mutation.js getter.js index.js ??
在main.js中引入index.js
import store from './store/index.js'/*?
????????new Vue({? el: '#app',? router, store,? components: { App },? template: ''
})?
? ? ? ? 然后頁(yè)面上 引入? import {mapGetters, mapActions} from 'vuex'
? ? ? ? ? ? 需要修改什么數(shù)據(jù),在methods中通過mapActions提交對(duì)應(yīng)的事件


? 在action里面進(jìn)行修改

action 通過commit提交到mutation

state.js中定義對(duì)應(yīng)數(shù)據(jù)并初始化

getter.js中拋出對(duì)應(yīng)的數(shù)據(jù)

頁(yè)面上如何使用?
