Skip to content
Advertisement

How to make onclick event to work only once in vue.js

this is the normal javascript code for calling onclick event only once:

JavaScript

the trick for normal javascript is this:

JavaScript

But, now I want this functionality in vue.js and my button in vue.js is like following:

JavaScript

Can anyone suggest me how to call event exactly once in vuejs….

Advertisement

Answer

Use the .once event modifier to handle the event only once:

JavaScript

demo

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement