Răsfoiți Sursa

[docs] inline actions

Evan You 9 ani în urmă
părinte
comite
c12527825b
1 a modificat fișierele cu 13 adăugiri și 0 ștergeri
  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