v-on
can be used to handle interaction with elements in your template. Modifiers like stop
and prevent
can be used in place to preventDefault()
and stopPropagation
. Vue.js can also capture key bindings such as v-on:keyup.enter
and v-on:keyup.13
.
What does the .prevent do, exactly? Why is it added in the end?
If you run the code on CodeSandbox and remove the prevent modifier, you'll notice that the form submission causes a page reload.