v-on naslouchá DOM událostem (kliky, vstup, stisk kláves) a spouští obslužnou rutinu. Její zkratka je @.
<script setup>
import { ref } from "vue";
const count = ref(0);
function increment() { count.value++; }
</script>
<template>
<button v-on:click="increment">Full syntax</button>
<button @click="increment">Shorthand (idiomatic)</button>
<button @click="count++">Inline expression</button>
<button @click="increment($event, 'extra')">Pass args + the event</button>
</template>
Můžete předat název metody, vložený výraz nebo zavolat metodu s argumenty. Nativní objekt události je dostupný jako .
