Require defense component input before showing Save button

This commit is contained in:
richard-dds
2019-06-12 15:58:20 -04:00
parent 0bafa51bb9
commit 31d95e51bc
4 changed files with 15 additions and 5 deletions

View File

@@ -17,6 +17,14 @@ export default {
type: Boolean,
default: false,
},
optional: Boolean
},
created: function() {
emitEvent('field-mount', this, {
optional: this.optional,
name: this.name,
})
},
data: function() {
@@ -31,13 +39,15 @@ export default {
methods: {
onInput: function(e) {
this.showError = false
this.showValid = true
emitEvent('field-change', this, {
value: e.target.value,
name: this.name,
watch: this.watch,
valid: this.showValid
})
this.showError = false
this.showValid = true
},
},
}

View File

@@ -15,7 +15,6 @@ export default {
handleFieldChange: function(event) {
const { value, name, valid, parent_uid, watch } = event
if (typeof this.fields[name] !== undefined) {
this[name] = value
this.fields[name] = valid
if (parent_uid === this._uid || watch) {
this.changed = true