v-on (@) Event Listener Directive

Last updated: 2026-10-22

v-on (@) Event Listener Directive

v-on attaches an event listener, shorthand @. Modifiers like .stop, .prevent or .once customize behaviour.

GroupDirectives
KindDirective
ScopeTemplate
Vue Version3.0+
SSR SupportYes

📝 Syntax

<button v-on:click="count++">+1</button>
<button @click="greet">Greet</button>
<form @submit.prevent="onSubmit">

⚙️ Arguments

expressionEvent name plus a handler or inline statement; modifiers like .stop, .prevent, .once, .self

Returns:Directive, no return value

▶ Example

Edit the code below and see the live result:

Output:

Shows 'Clicked 0 times'; each click increments the counter.

💡 Key Points

💡 Tip @ is shorthand for v-on: — everyday code uses @click.
ℹ️ Note Common modifiers: .stop, .prevent, .once and .self.
⚠️ Warning Pass the method name without parentheses (@click="greet"); add them only to pass arguments.
More case studies coming soon.

📚 Related Tutorials

❓ FAQ

Q Difference between @click="fn" and @click="fn()"?
A The former passes the event object automatically; parentheses are for passing custom arguments.
Q Can modifiers be chained?
A Yes, e.g. @click.stop.prevent — applied left to right.
Q How to listen for keyboard events?
A Use key modifiers like @keyup.enter or @keydown.esc.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏