06笔记vuex actions 04
// App.vue <template> <div id="app"> {{ count }} <button @click="increment">+</button> <button @click="decrement">-</button> </div> </template> <script> import { mapState } from 'vuex'; // import { mapState, mapActions } from 'vuex'; export default { name: 'app', computed: mapState([ 'count' ]), methods: { increment () { // this.$store.commit('increment'); this.$store.dispatch('incrementAsync'); }, decrement () { // this.$store.commit('decrement'); this.$store.dispatch('decrement'); }, testAction () { this.$store.dispatch('actionA').then(() => { }); } } // methods: mapActions([ // 'increment',