浏览代码

[docs] inline actions

Evan You 9 年之前
父节点
当前提交
c12527825b
共有 1 个文件被更改,包括 13 次插入0 次删除
  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