[Vuejs]-Checking if the input field is completed

0👍

You just need to wrap your inputs inside a <form> element (lowercased!) to get native form validation.

// Form.vue
<template>
  <form ref="myForm">
    <KeepAlive>
      <component :is="currentStep" @previous="previousStep" @next="nextStep" />
    </KeepAlive>
  </form>
</template>

You can also check the validity programatically by using this.$refs.myForm. checkValidity().

Leave a comment