diff --git a/src/components/html/EcDynamicField.html b/src/components/html/EcDynamicField.html index f0b1d95..8afdb00 100644 --- a/src/components/html/EcDynamicField.html +++ b/src/components/html/EcDynamicField.html @@ -4,8 +4,7 @@ v-bind="{name: field, schema: schema}" v-if="dynamicField" :key="field" - :value="value" - @input="$emit('input', $event)" + v-model="localValue" :is="dynamicField" /> diff --git a/src/components/js/EcDynamicField.js b/src/components/js/EcDynamicField.js index cc78e01..f1dfc3b 100644 --- a/src/components/js/EcDynamicField.js +++ b/src/components/js/EcDynamicField.js @@ -2,18 +2,23 @@ import { discover } from '../../utils/Discoverer.js' export default { name: 'EcDynamicField', + props: { - field: { - type: String - }, - schema: { - type: Object - }, - value: { - type: [String, Number, Boolean, Object] - } + field: String, + schema: Object, + value: [String, Number, Boolean, Object] }, + computed: { + localValue: { + get () { + return this.value + }, + set (value) { + this.$emit('input', value) + } + }, + dynamicFields () { return discover(this.field, this.schema) }