Add extendValidator
prop
#740
btea
started this conversation in
RFC Discussions
Replies: 1 comment 13 replies
-
Can't you just add console.warn in normal validator? |
Beta Was this translation helpful? Give feedback.
13 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
Expand the warning information of validator verification to provide clearer error prompts.
Basic example
Motivation
In custom components, we usually validate many props for a better user experience. Currently, the validator function will only return true or false. If it is false, it means that the validation has failed and a warning message will be thrown inside vue.
However, the warning message only indicates that a prop check failed, but users cannot customize and expand more specific error descriptions.
Detailed design
In order not to affect the original users, it may be a good idea to add a new function to give users more customization space.
refer #Basic example
Drawbacks
In most cases, the current validator function will suffice. (This proposal is merely to optimize the development experience based on the original one.)
Alternatives
Add new parameters based on the original validator and make different processing according to different parameters.
Adoption strategy
Unresolved questions
N/A
Beta Was this translation helpful? Give feedback.
All reactions