How to call a multiple functions in single v-on
event?
No difference: click, focus or whatever?
Something like:
<div v-on:click="fn1('foo');fn2('bar')"> </div>
Or may be:
<div v-on:click="fn1('foo')"
v-on:click="fn2('bar')"> </div>
How to do it right?
UPDATE: Yes, of course I always can do
<div v-on:click="fn3('foo', 'bar')"> </div>
function fn3 (args) {
fn1(args);
fn2(args);
}
But that's really ugly.
This simple way to do v-on:click="firstFunction(); secondFunction();"
The
Vue
event handling only allows for single function calls. If you need to do multiple ones you can either do a wrapper that includes both:EDIT
Another option is to edit the first handler to have a callback and pass the second in.