I\'m using Vue in my application and I would like to know how to submit a form but avoid redirection. According to the official Vue doc it can be achieved in the following w
Try @submit.prevent="myFunction()"
, and your button
could instead be . The
submit
type will trigger the form to submit, and the submit.prevent
will prevent the default submit behavior and execute myFunction
as desired.
This has the additional benefit of triggering form validation for required input fields!