-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed
Labels
Description
What problem does this feature solve?
- Allows to write validation logic depending on multiple props.
- Allows to provide custom validation messages.
What does the proposed API look like?
type Validator = (value: any, key: string, props: Object, warn: (message: string) => void) => boolean
Example:
export default {
props: {
foo: {
validator(value, key, props, warn) {
if ('bar' in props && 'foo' in props) warn('Foo and Bar cannot be used together.')
return true
}
....
sqal, dima74, LMarcinkowski, kayandra, jansalwowski and 6 moreSnosMe