From 0f69cf10d667223ea365bab075843469cfacee31 Mon Sep 17 00:00:00 2001 From: estacet <44970087+estacet@users.noreply.github.com> Date: Thu, 22 Apr 2021 00:30:22 +0300 Subject: [PATCH] docs: add info about multiple args for action --- docs/guide/actions.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/guide/actions.md b/docs/guide/actions.md index 226cf9834..f085fab02 100644 --- a/docs/guide/actions.md +++ b/docs/guide/actions.md @@ -121,6 +121,20 @@ export default { } ``` +You can pass only one argument to action. If you want to pass more than one argument, use an Array or an Object: + +```js + // Action call from component +const user = { + email: this.email, + password: this.password +} +this.login(user) + +// Action in Vuex +login({ commit }, { email, password }) {...} +``` + ## Composing Actions Actions are often asynchronous, so how do we know when an action is done? And more importantly, how can we compose multiple actions together to handle more complex async flows?