vuex
vuex copied to clipboard
docs: add info about multiple args for action
Thanks for the PR. I think this is lay terms for what already exists. For example, read the following excerpt from the Action docs. Could I therefore ask what your interpretation of this is and whether this just duplicates what's already stated?
Actions support the same payload format and object-style dispatch
// dispatch with a payload
store.dispatch('incrementAsync', {
amount: 10
})
// dispatch with an object
store.dispatch({
type: 'incrementAsync',
amount: 10
})
Yeah, I think this addition is a little too much? But I do understand sometime people gets confused, or not sure how to pass multiple argument. So how about we add a note at here, stating that a 3rd argument will be ignored and if you want pass multiple arguments, users should pass an object or arrays.
We should do the same for mutations though.
Explicitly stating that only one argument is accepted as a payload would especially help those who are explicitly looking for information at the Actions section of the docs (that is, using it as a reference, not reading the sections in order). It may also help developers who use English as their second language, and it would also make the docs more approachable for beginners.