浏览代码

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

Bo Andersen 8 年之前
父节点
当前提交
5f6b53411e
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      docs/en/mutations.md

+ 4 - 1
docs/en/mutations.md

@@ -146,7 +146,10 @@ export default {
   // ...
   // ...
   methods: {
   methods: {
     ...mapMutations([
     ...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({
     ...mapMutations({
       add: 'increment' // map this.add() to this.$store.commit('increment')
       add: 'increment' // map this.add() to this.$store.commit('increment')