vuetify required field allow 0 code example
Example: vuetify required field allow 0
// I want the fields of my form to be required (using Vuetify built-in validation).
// Some of them are numbers and Vuetify doesn't like when I input 0 (because 0 == false).
// The solution is to evaluate a string inside of the 'required' method.
// Instead of writing this :
rules: {
required: v => !!v || 'Field is required',
}
// (If v is NOT not false (!!v), return true, else return 'Field is required')
// Just write this :
rules: {
required: v => !!`${v}` || 'Field is required'
}