Is there a way to call multiple functions with a single event using @click
(or v-on:click
)?
I have attempted the following methods:
Separating the functions by a semicolon:
<div @click="fn1('foo');fn2('bar')"> </div>
Using multiple
@click
attributes:<div @click="fn1('foo')" @click="fn2('bar')"> </div>
To work around this, I can create a handler like this:
<div v-on:click="fn3('foo', 'bar')"> </div>
function fn3 (args) {
fn1(args);
fn2(args);
}
However, this workaround may not always be ideal. What would be the correct method or syntax for achieving this functionality?