Field's without initial values commit undefined values, this fixes failing validation
This commit is contained in:
parent
6391a14f0e
commit
b0de7b5ee7
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -99,19 +99,15 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.hydrate(this.mergedInitial)
|
this.hydrate(this.mergedInitial)
|
||||||
// this.$emit('mounted', true)
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
registerField (field, data) {
|
registerField (field, data) {
|
||||||
this.$store.commit(`${this.m}setFieldMeta`, {form: this.name, field, data})
|
this.$store.commit(`${this.m}setFieldMeta`, {form: this.name, field, data})
|
||||||
if (this.mergedInitial.hasOwnProperty(field)) {
|
this.$store.commit(`${this.m}setFieldValue`, {
|
||||||
this.$store.commit(`${this.m}setFieldValue`, {
|
field,
|
||||||
field,
|
value: this.mergedInitial.hasOwnProperty(field) ? this.mergedInitial[field] : undefined,
|
||||||
value: this.mergedInitial[field],
|
form: this.name
|
||||||
form: this.name
|
})
|
||||||
})
|
|
||||||
}
|
|
||||||
// this.updateFormValidation()
|
|
||||||
},
|
},
|
||||||
deregisterField (field) {
|
deregisterField (field) {
|
||||||
this.$store.commit(`${this.m}removeField`, {
|
this.$store.commit(`${this.m}removeField`, {
|
||||||
@ -129,7 +125,6 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// this.updateFormValidation()
|
|
||||||
},
|
},
|
||||||
setInitial (field, value) {
|
setInitial (field, value) {
|
||||||
this.fieldInitials = Object.assign({}, this.fieldInitials, {[field]: value})
|
this.fieldInitials = Object.assign({}, this.fieldInitials, {[field]: value})
|
||||||
@ -138,7 +133,6 @@ export default {
|
|||||||
this.$store.commit(`${this.m}setFieldValue`, Object.assign(change, {
|
this.$store.commit(`${this.m}setFieldValue`, Object.assign(change, {
|
||||||
form: this.name
|
form: this.name
|
||||||
}))
|
}))
|
||||||
// this.updateFormValidation()
|
|
||||||
},
|
},
|
||||||
updateFieldErrors (change) {
|
updateFieldErrors (change) {
|
||||||
this.$store.commit(`${this.m}setFieldErrors`, Object.assign(change, {
|
this.$store.commit(`${this.m}setFieldErrors`, Object.assign(change, {
|
||||||
|
Loading…
Reference in New Issue
Block a user