Click events 5 / 42
Using v-on:
we can define event listeners for DOM events.
In this example, we are mutating the state when the user clicks the increment button.
Notice how we can write JavaScript expressions directly inside the value of v-on:
.
A widely used shortcut for v-on:click
is @click
. Try changing it, we will be using it a lot.