The method in Vue runs twice on click
It is a default browser behavior. Clicking on the <label>
will trigger 2 clicks, one for <label>
and one for <input>
.
Way to avoid that is to add @click.prevent
to your <label>
tag.
If you move @click="set(rating)"
to <input/>
instead of <label/>
, it will run once.
@click.stop="clickfunction($event)"
This will stop next calls and will call function only once.