Browse Source

Added example of passing payload to mutation with mapMutations helper (#734)

Bo Andersen 8 năm trước cách đây
mục cha
commit
5f6b53411e
1 tập tin đã thay đổi với 4 bổ sung1 xóa
  1. 4 1
      docs/en/mutations.md

+ 4 - 1
docs/en/mutations.md

@@ -146,7 +146,10 @@ export default {
   // ...
   methods: {
     ...mapMutations([
-      'increment' // map this.increment() to this.$store.commit('increment')
+      'increment', // map this.increment() to this.$store.commit('increment')
+      
+      // mapMutations also supports payloads:
+      'incrementBy' // this.incrementBy(amount) maps to this.$store.commit('incrementBy', amount)
     ]),
     ...mapMutations({
       add: 'increment' // map this.add() to this.$store.commit('increment')