atst/js/mixins/form.js
2019-04-06 16:57:12 -04:00

31 lines
542 B
JavaScript

export default {
mounted: function() {
this.$root.$on('field-change', this.handleFieldChange)
},
methods: {
handleFieldChange: function(event) {
const { value, name } = event
if (typeof this[name] !== undefined) {
this[name] = value
if (event['parent_uid'] === this._uid) {
this.changed = true
}
}
},
},
data: function() {
return {
changed: this.hasChanges,
}
},
props: {
hasChanges: {
type: Boolean,
default: false,
},
},
}