cheetah-framework
Version:
Cheetah Framework JS used in all our applications
43 lines (36 loc) • 766 B
JavaScript
import FormError from './FormError'
export default {
mixins: [FormError],
props: {
name: {
type: String,
default: null
},
customError: {
type: String,
default: null
}
},
computed: {
inputErrorPath () {
return this.suffixedErrorPath + this.name
},
error () {
if (this.customError) {
return this.customError
}
if (this.name && this.formErrors.has(this.inputErrorPath) !== false) {
return this.formErrors.get(this.inputErrorPath)
}
return false
},
hasInputError () {
return this.formErrors.has(this.inputErrorPath) !== false
}
},
methods: {
forgetInputError () {
this.formErrors.forget(this.inputErrorPath)
}
}
}