I am working with a Vue component that has numerous props.
<Field
v-for="field in fields"
:key="field.name"
:name="field.name"
:type="field.type"
:label="field.label"
:values="field.values"
:value="field.value"
/>
My validation process looks like this:
props: {
name: {
type: String,
required: true
},
label: {
type: String,
required: true
},
type: {
type: String,
default: 'text'
},
value: {
type: String,
default: ''
},
values: [Object]
}
Therefore, I would like to pass all properties as one object, for example:
<Field
v-for="field in fields"
:key="field.name"
:params="field"
/>
Do you have any suggestions on how I can validate and return default values for the properties of this object?