$params set to null
See original GitHub issueWe have a complicated issue with Vue and Vuelidate, basically we’ve made a Vue component library with Vue and Vuelidate. The library is built with Rollup.
Some components are validated like so:
import { maxLength } from 'vuelidate/lib/validators'
...
validations() {
return {
value: {
maxLength: maxLength(4)
}
}
}
...
This means the number 4
should be available as a param to be used in an error message. This works in the tests in the lib and also in a standalone Vue app that can be run from the lib. $v.value.$params
is consequently defined as so:
{
maxLength: {
type: "maxLength",
max: 4
}
}
The 4 can then be used in an error message, e.g. “you cannot enter more than 4 characters”.
However, when the lib is imported to another app, the $v.value.$params
is set to null. Thus the error message becomes: “you cannot enter more than characters”.
We’ve found a couple of issues on this (https://github.com/vuelidate/vuelidate/issues/302, https://github.com/vuelidate/vuelidate/issues/460) but none of the suggested solutions seems to work.
Any help is appreciated!
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:15 (3 by maintainers)
@dobromir-hristov I refer to changes made from 0.7.4 to 0.7.7 regarding param handling. But the problem which occured there only targets external library which are build on top on vuelidate and released via a bundler e.g. webpack, rollup etc.
This was a major change for this target group but non in your general versioning.
This is an ugly monkey-patch, though, it works:
https://gist.github.com/leonid-chernyavskiy/a08395005da5eacf8f2f293ce544f594