@click vue code example
Example 1: @keyup.enter vue
<input v-on:keyup.enter="submit">
<!-- Also works like this: -->
<input @keyup.enter="submit">
Example 2: click in vue
<button @click="setComponent('manage')">manage</button>
Example 3: click vue
<button v-on:click="warn('Form cannot be submitted yet.', $event)">
Submit
</button>
methods: {
warn: function (message, event) {
if (event) {
event.preventDefault()
}
alert(message)
}
}
Example 4: vue js button click
<div id="example-2">
<!-- `greet` is the name of a method defined below -->
<button v-on:click="greet">Greet</button>
</div>