Browse Source

[docs] inline actions

Evan You 9 years ago
parent
commit
c12527825b
1 changed files with 13 additions and 0 deletions
  1. 13 0
      docs/en/actions.md

+ 13 - 0
docs/en/actions.md

@@ -103,6 +103,19 @@ const vm = new Vue({
 
 Now the action will be bound as `vm.plus` instead of `vm.incrementBy`.
 
+If an action is specific to a component, you can take the shortcut and just define it inline:
+
+``` js
+const vm = new Vue({
+  vuex: {
+    state: { ... },
+    actions: {
+      plus: ({ dispatch }) => dispatch('INCREMENT')
+    }
+  }
+})
+```
+
 Finally, if you simply want to bind all the actions:
 
 ``` js