Update TO form and nested components to emit directly to parent components instead of emitting from the root component
This commit is contained in:
@@ -50,8 +50,12 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
mounted: function() {
|
||||
this.$on('field-change', this.handleFieldChange)
|
||||
},
|
||||
|
||||
methods: {
|
||||
handleDateChange: function(event) {
|
||||
handleFieldChange: function(event) {
|
||||
if (event.name.includes(START_DATE) && event.valid) {
|
||||
let date = new Date(event.value)
|
||||
this.minEndDate = this.calcMinEndDate(date)
|
||||
@@ -59,6 +63,7 @@ export default {
|
||||
let date = new Date(event.value)
|
||||
this.maxStartDate = this.calcMaxStartDate(date)
|
||||
}
|
||||
this.$parent.$emit('field-change')
|
||||
},
|
||||
|
||||
calcMaxStartDate: function(date) {
|
||||
@@ -86,5 +91,9 @@ export default {
|
||||
minEndProp: function() {
|
||||
return format(this.minEndDate, 'YYYY-MM-DD')
|
||||
},
|
||||
|
||||
valid: function() {
|
||||
return this.$children.every(child => child.valid)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user