-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Closed
Labels
✨ feature requestNew feature or requestNew feature or request
Description
What problem does this feature solve?
This issue I had frequently in vue 2 as well but never really questioned it.
Is there a reason why the prop validator doesn't have access to the other props? If so I could not find any related discussion.
This would be very helpful if I would like to validate a prop one way if another prop is present, and another way if it isn't.
As far as I can tell the props can be passed to the validateProp from here
There is currently a workaround using watchers, but in my opinion that isn't as clean as this would be.
I would be happy to PR this if wanted.
What does the proposed API look like?
prop: {
type: Array,
required: true,
validator: (value, props) => {
return props.someBooleanFlag
? ... validate one way
: ... validate another way
}
},
lloydjatkinson, posva, aztalbot, kuanyui, Azema4ka and 4 morekuanyui, Azema4ka and sidelong44
Metadata
Metadata
Assignees
Labels
✨ feature requestNew feature or requestNew feature or request