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

Fixes a reactivity issue with initial props

This commit is contained in:
Justin Schroeder 2018-02-05 14:17:26 -05:00
parent 4655e2a31f
commit 797a52bb5a
3 changed files with 11 additions and 3 deletions

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -71,6 +71,11 @@ export default {
return this.behavior === 'live'
}
},
watch: {
initial () {
this.hydrate(this.initial)
}
},
created () {
this.hydrate(this.initial)
},
@ -83,7 +88,7 @@ export default {
this.updateFormValidation()
},
hydrate (values) {
for (let field in this.fields) {
for (let field of this.fields) {
if (field.type !== 'submit') {
this.$store.commit(`${this.m}setFieldValue`, {
field: field.name,
@ -135,6 +140,6 @@ export default {
this.$emit('submit', Object.assign({}, this.values))
}
}
}
},
}
</script>

View File

@ -279,6 +279,9 @@ export default {
errors: this.localAndValidationErrors
})
}
},
initial () {
this.form.update({field: this.name, value: this.initial})
}
},
created () {