Watch for changes on the options input, which is a grandchild of base-form

This commit is contained in:
Montana
2019-05-01 17:22:32 -04:00
parent 5692088837
commit 416ea1de82
7 changed files with 18 additions and 9 deletions

View File

@@ -1,8 +1,11 @@
import { emitEvent } from '../lib/emitters'
import FormMixin from '../mixins/form'
export default {
name: 'optionsinput',
mixins: [FormMixin],
props: {
name: String,
initialErrors: {
@@ -10,6 +13,10 @@ export default {
default: () => [],
},
initialValue: String,
watch: {
type: Boolean,
default: false,
},
},
data: function() {
@@ -27,6 +34,7 @@ export default {
emitEvent('field-change', this, {
value: e.target.value,
name: this.name,
watch: this.watch,
})
this.showError = false
this.showValid = true

View File

@@ -1,6 +1,6 @@
import FormMixin from '../mixins/form'
import textinput from './text_input'
import optionsinput from './options_input'
import textinput from './text_input'
export default {
name: 'toggler',

View File

@@ -16,8 +16,7 @@ export default {
const { name, valid, parent_uid } = event
if (typeof this[name] !== undefined) {
this.fields[name] = valid
if (parent_uid === this._uid) {
if (event['parent_uid'] === this._uid || event['watch']) {
this.changed = true
}
}