Answer the question
In order to leave comments, you need to log in
How to pass multiple parameters to an action in Vue(vuex)?
I want to pass several parameters to the action (vuex) when the event is triggered:
I.e. I pass the event itself and another task object. The action itself looks like this:<div @dragstart="dragStart($event, task)"></div>
dragStart({state, commit, getters}, event, task) {
commit(mutations.START_DRAG, {state, getters, event, task});
},
<div @dragstart="dragStart([$event, task])"></div>
Answer the question
In order to leave comments, you need to log in
<div @dragstart="dragStart({$event, task})"></div>
dragStart({state, commit, getters}, {event, task}) {
commit(mutations.START_DRAG, {state, getters, event, task});
},
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question