Sometimes, we want to handle mouse button down event with Vue.js.
In this article, we’ll look at how to handle mouse button down event with Vue.js.
How to handle mouse button down event with Vue.js?
To handle mouse button down event with Vue.js, we can listen to the mousedown
event.
For instance, we write
<template>
<div>
<button @mousedown="mouseDown">mouse down</button>
</div>
</template>
to listen to the mousedown
event with @mousedown
.
We run the mouseDown
method when we press down the mouse button when our cursor is on the button.
Conclusion
To handle mouse button down event with Vue.js, we can listen to the mousedown
event.