No need for 'valid' data

Add name prop, and event emitter for changes
This commit is contained in:
Andrew Croce 2018-08-08 11:41:27 -04:00
parent 725e76dfa4
commit 6bcf7dee28

View File

@ -9,6 +9,7 @@ export default {
},
props: {
name: String,
validation: {
type: String,
default: () => 'anything'
@ -21,7 +22,6 @@ export default {
data: function () {
return {
valid: false,
showError: false,
showValid: false,
mask: inputValidations[this.validation].mask,
@ -60,8 +60,14 @@ export default {
} else if (invalidate) {
this.showError = true
}
this.valid = valid
this.showValid = valid
// Emit a change event
this.$emit('fieldChange', {
value,
valid,
name: this.name
})
},
_validate: function (value) {