4👍
✅
$v.text
is valid because it is a non-empty object. That means it doesn’t have ‘falsy’ value so it meets the requirement. One way to make it work:
validations: {
text: {
id: {required},
name: {required},
},
},
If you don’t want to repeat items object structure, you can write a custom validator.
1👍
There is missing information about how to use withParams
in the documentation of vuelidate page.
So i have searched on its github page and found this link .
According to link i came up with that solution
import { withParams } from 'vuelidate'
export const checkIfNull = withParams(
{ type: 'required' },
value => (value.id === null ? false : true)
)
0👍
There is nothing special about validating an object, you just need to define the structure and add any validation rules you require.
Please see the example I created and take another look at the Collections docs.
Source:stackexchange.com