Can I use a variable to validate? See example below:
data: function () {
return {
variable: 10
}
},
validations: {
form: {
example: {
between: between(this.variable, 400)
}
}
},
Yes, it's possible. You just have to enclose it into another function.
example: {
between (value) {
return between(this.variable, 400)(value)
}
}
Not working!
@Frizi what is value in your example? Why this is not working?
maxLength () {
return maxLength(this.countProp)
}
@ChrisRobston you can do that like this
validations () {
return {
textfieldValue: {
required,
maxLength: maxLength(this.countProp)
}
}
}
Most helpful comment
Yes, it's possible. You just have to enclose it into another function.