Vue 3 v-on Directive
v-on The directive is used to bind event listeners, listening for DOM events or custom events.
Basic Explanation
v-on The directive is used to bind event handler functions to elements. You can use it to listen for native DOM events or events emitted by custom components.
- Shorthand: @
- Expected type: Function | Inline Statement | Object
- Purpose: binds event listeners, supporting native DOM events and custom events.
Basic Usage
Example
Click
Example
Increment
Count: {{ count }}
Event Modifiers
Example
Stop propagation
Vue 3 Built-in Directives