1
0
mirror of synced 2024-11-22 05:16:05 +03:00

Fixes issue #6. Changes validation to occur via watcher of the vuex store

This commit is contained in:
Justin Schroeder 2018-04-10 10:51:26 -04:00
parent d50a0ebe25
commit 25c618a4cf
2 changed files with 14 additions and 4 deletions

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -89,6 +89,9 @@ export default {
watch: {
mergedInitial () {
this.hydrate(this.mergedInitial)
},
values () {
this.updateFormValidation()
}
},
created () {
@ -100,7 +103,14 @@ export default {
methods: {
registerField (field, data) {
this.$store.commit(`${this.m}setFieldMeta`, {form: this.name, field, data})
this.updateFormValidation()
if (this.mergedInitial.hasOwnProperty(field)) {
this.$store.commit(`${this.m}setFieldValue`, {
field,
value: this.mergedInitial[field],
form: this.name
})
}
// this.updateFormValidation()
},
deregisterField (field) {
this.$store.commit(`${this.m}removeField`, {
@ -118,7 +128,7 @@ export default {
})
}
}
this.updateFormValidation()
// this.updateFormValidation()
},
setInitial (field, value) {
this.fieldInitials = Object.assign({}, this.fieldInitials, {[field]: value})
@ -127,7 +137,7 @@ export default {
this.$store.commit(`${this.m}setFieldValue`, Object.assign(change, {
form: this.name
}))
this.updateFormValidation()
// this.updateFormValidation()
},
updateFieldErrors (change) {
this.$store.commit(`${this.m}setFieldErrors`, Object.assign(change, {