官方的购物车例子,还有别人仿的bilibili项目都有类似下面这种:
state: {
  status: ''
},
getter: {
  status: state => state.status
},
actions: {
  checkout ({commit, state}, products) {
    commit(types.CHECKOUT_REQUEST)
  }
},
mutations: {
  [types.CHECKOUT_REQUEST] (state) {
    ...
  }
}1.为什么mutations里要用数组的命名方式?
2.为什么还要把state里的内容再在getter里走一遍?
慕森卡
胡子哥哥