I'm using VueJS 2.3.0, and now I need to update HTML element's class after it's clicked.
I have this template code:
<template id="model-template">
<span>
<button v-on:click="activate" >{{ model.fu }} month</button>
</span>
</template>
I just checked the VueJS official documentation about :class solution, but I'm confused...
If I use jQuery, then I code this to do what I want to do:
$('button').each(function() {
$(this).click(function() {
$('button').removeClass('clicked');
$(this).addClass('clicked');
});
});
UPDATE: this is find all buttons, remove 'clicked' class from each button elements, and add 'clicked' class to only that one what the user is clicked.
How can I do same thing in VueJS?