[VueJS] use Vue properties with vue-vuelidate-jsonschema
€8-30 EUR
Completed
Posted over 5 years ago
€8-30 EUR
Paid on delivery
Please find attached a very simple working sample (2 fields and one button) for
[login to view URL] (a vue mixin validator based using vuelidate).
The sample has validation already working i.e.:
- typing non-valid data raises error
- submit button displays the error when there is an error
The job is to extract formSchema and formObject so they become vue properties of the component, i.e.
props: {
formSchema: { type: Object, required: true },
formObject: { type: Object, default: () => ({}) },
formSchema: a simple json schema (fields: name, age)
formObject: object validated against the json schema.
and make sure the sample still works.
formSchema: {
type: 'object',
properties: {
name: {
type: 'string',
pattern: '^\\w+\\s\\w+$'
},
age: {
type: 'integer',
default: 20,
minimum: 18,
maximum: 30
}
},
required: ['name']
}
,
formObject: {
name: 'James',
age: 45
}