import {
mapMutations,mapGetters
} from 'vuex'
mutations: {
incrementCount(state){
return state.count+=1;
},
// decrementCount(state,n){
// return state.count-=n;
// },
//可以传一个对象,数组
decrementCount(state,payload){
return state.count-=payload.mount;
}
button @click="incrementCount()">+</button>
<div>{{mount}}</div>
<button @click="decrementCount({mount:10})">=</button>
methods: {
// crease() {
// console.log(11)
// this.$store.commit("incrementCount",9)
// },
// decrease(m) {
// console.log(11)
// this.$store.commit("decrementCount",m)
// }
// }
methods: mapMutations(['decrementCount', 'incrementCount'])