I'm trying to get an example from the VeeValidate docs to work. It can be found here. I'm clearly missing something but I don't know what.
My form is always valid, even though I'm not adding any text to the inputs. Do I need to customise the required rule somehow? CodeSandbox
<template>
<ValidationObserver ref="observer" v-slot="{ invalid }" tag="form" @submit.prevent="submit()">
<input type="text" rules="required">
<br>
<input type="text" rules="required">
<br>
<button :disabled="invalid">Submit</button>
</ValidationObserver>
</template>
<script>
import { ValidationObserver } from "vee-validate";
export default {
components: {
ValidationObserver
},
methods: {
async submit() {
const isValid = await this.$refs.observer.validate();
console.log("Form is valid", isValid);
if (!isValid) {
// ABORT!!
}
// ship it
}
}
};
</script>