Allow null values
This commit is contained in:
parent
0b33405493
commit
39ec99ed29
7 changed files with 28 additions and 14 deletions
|
|
@ -26,7 +26,10 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
value: {
|
value: {
|
||||||
type: Array,
|
type: Array,
|
||||||
required: true
|
required: false,
|
||||||
|
default: function() {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
type: Array,
|
type: Array,
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
label: {
|
label: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: false,
|
||||||
|
default: ""
|
||||||
},
|
},
|
||||||
name: {
|
name: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,13 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
value: {
|
value: {
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true
|
required: false,
|
||||||
|
default: 0
|
||||||
},
|
},
|
||||||
placeholder: {
|
placeholder: {
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true
|
required: false,
|
||||||
|
default: NaN
|
||||||
},
|
},
|
||||||
name: {
|
name: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,8 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
value: {
|
value: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: false,
|
||||||
|
default: ""
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
type: Array,
|
type: Array,
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,8 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
value: {
|
value: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: false,
|
||||||
|
default: ""
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
type: Array,
|
type: Array,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<label class="uk-form-label">{{ label }}</label>
|
<label v-if="label" class="uk-form-label">{{ label }}</label>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
class="uk-input uk-form-small"
|
class="uk-input uk-form-small"
|
||||||
|
|
@ -20,11 +20,13 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
placeholder: {
|
placeholder: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: false,
|
||||||
|
default: null
|
||||||
},
|
},
|
||||||
label: {
|
label: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: false,
|
||||||
|
default: null
|
||||||
},
|
},
|
||||||
name: {
|
name: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|
@ -32,7 +34,8 @@ export default {
|
||||||
},
|
},
|
||||||
value: {
|
value: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: false,
|
||||||
|
default: ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -156,13 +156,16 @@ export default {
|
||||||
*/
|
*/
|
||||||
for (const field of this.schema) {
|
for (const field of this.schema) {
|
||||||
if (Array.isArray(field)) {
|
if (Array.isArray(field)) {
|
||||||
|
var defaultValue; // Initial value of the form component
|
||||||
for (const subfield of field) {
|
for (const subfield of field) {
|
||||||
console.log(subfield.name);
|
// If a default value is given in the schema, use this
|
||||||
this.$set(this.formData, subfield.name, null);
|
defaultValue = subfield.default ? subfield.default : null;
|
||||||
|
this.$set(this.formData, subfield.name, defaultValue);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log(field.name);
|
// If a default value is given in the schema, use this
|
||||||
this.$set(this.formData, field.name, null);
|
defaultValue = field.default ? field.default : null;
|
||||||
|
this.$set(this.formData, field.name, defaultValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue