Level 35
It depends on what you do next but you could set a variable:
// disable the button if clicked = true
<button @click="doSomething" :disabled="clicked">LIKE</button>
// your vuejs code
data: function() {
return {
clicked: false,
}
},
methods: {
doSomething: function() {
// we only continue if not clicked before
if (this.clicked) {
return;
}
this.clicked = true;
// do something to process the like
// at some point release the 'clicked' state
this.clicked = false;
// or if you want to release the clicked state after a second (for whatever reason)
setTimeout(function(){
this.clicked = false;
}.bind(this),1000);
}
}