Sometimes, we want to call multiple functions with @click in Vue.js.
In this article, we’ll look at how to call multiple functions with @click in Vue.js.
How to call multiple functions with @click in Vue.js?
To call multiple functions with @click in Vue.js, we can set @click
to all the function calls separated by semicolons.
For instance, we write
<template>
<div
@click="
firstFunction();
secondFunction();
"
></div>
</template>
to call firstFunction
and secondFunction
when we click on the div by setting @click
to
firstFunction();
secondFunction();
Conclusion
To call multiple functions with @click in Vue.js, we can set @click
to all the function calls separated by semicolons.