control error display for options input component
This commit is contained in:
@@ -2,15 +2,31 @@ export default {
|
||||
name: 'optionsinput',
|
||||
|
||||
props: {
|
||||
name: String
|
||||
name: String,
|
||||
initialErrors: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
showError: (this.initialErrors && this.initialErrors.length) || false,
|
||||
showValid: false,
|
||||
validationError: this.initialErrors.join(' ')
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
methods: {
|
||||
onInput: function (e) {
|
||||
this.$root.$emit('field-change', {
|
||||
value: e.target.value,
|
||||
name: this.name
|
||||
})
|
||||
this.showError = false
|
||||
this.showValid = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user