Help with v-on functions
I have a button and when i click that, I need to call the function
foo
and pass 45
as an argument.2 Replies
Hi @AD007xD. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To handle a button click event and call a function with an argument in Nuxt/Vue, you can use the
v-on
directive (or its shorthand @
). Here's how you can implement it:
The @click
directive (shorthand for v-on:click
) will trigger the foo
function with the argument 45
whenever the button is clicked.
If you're using Nuxt UI, you can also use the loading features with your button as shown in the Nuxt UI documentation:
This will automatically show a loading state while your function is processing.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@699225692918906900> Kapa.ai is still learning and improving, please let me know how I did by reacting below.