Use form mixin for add field change handler

This commit is contained in:
Patrick Smith
2018-08-23 16:33:13 -04:00
parent f599abb5dd
commit b8a983f4dc
4 changed files with 24 additions and 37 deletions

View File

@@ -1,3 +1,4 @@
import FormMixin from '../../mixins/form'
import optionsinput from '../options_input'
import textinput from '../text_input'
import checkboxinput from '../checkbox_input'
@@ -5,6 +6,8 @@ import checkboxinput from '../checkbox_input'
export default {
name: 'poc',
mixins: [FormMixin],
components: {
optionsinput,
textinput,
@@ -26,18 +29,5 @@ export default {
return {
am_poc
}
},
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
}
},
}
}