I am experiencing an issue with my code where the button is supposed to be disabled on mousedown event and enabled back on mouseup event. However, for some reason, the button does not get enabled on mouseup event.
Here's the snippet of my code:
new Vue({
el: "#app",
data: {
clicked: false
},
methods: {
toggle(type) {
if (type === "down") {
this.clicked = true
} else {
this.clicked = false // The issue arises here as mouseup event doesn't work as expected
}
}
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<button
@mouseup="toggle('up')"
@mousedown="toggle('down')"
:disabled="clicked"
>Button</button>
</div>