0👍
I have not used Typescript, but ultimately, you’ll have to validate each model onSubmit. So, in the submit()
function that you have, do preventDefault()
, validate your fields and if all okay then go ahead actually do submit the form to the backend.
Do read the guide for general workflow: https://v2.vuejs.org/v2/cookbook/form-validation.html
Also, do check out Vuelidate and VeeValidate which are simple validation frameworks for VueJS.
p.s.: see: using Vuelidate with Typescript issue first for good pointers.
Source:stackexchange.com