This content originally appeared on CodeSource.io and was authored by Prince Chukwudire
In this guide, we will be taking a look at how to use the Vue v-on
directive.
Basically, the v-on
directive is used to listen to DOM events and run some JavaScript when they’re triggered.
Here’s a sample:
<template>
<div>
<button type="button" v-on:click="step += 1">Add Step</button>
<p>The button has added {{ step }} steps</p>
</div>
</template>
<script>
export default {
data() {
return {
step: 2,
};
},
};
</script>
The post Handling DOM events with Vue v-on appeared first on CodeSource.io.
This content originally appeared on CodeSource.io and was authored by Prince Chukwudire
Prince Chukwudire | Sciencx (2021-02-17T16:42:35+00:00) Handling DOM events with Vue v-on. Retrieved from https://www.scien.cx/2021/02/17/handling-dom-events-with-vue-v-on/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.