Kimkykie
Kimkykie

Reputation: 49

Remove v-on:click event from an element when it's clicked on

How do I remove the v-on:click event from a div when I click on it.

<div id="five" v-on:click="setIcon"></div>

I want the setIcon click event to be removed immediately I click on this element. I have several other elements that I want to behave this way.

Upvotes: 1

Views: 466

Answers (1)

Bert
Bert

Reputation: 82489

Use the .once event modifier.

<div id="five" v-on:click.once="setIcon"></div>

Upvotes: 3

Related Questions