[Vuejs]-Vue 3: make depended props of other props in one component

-1👍

You can try using the validator function available for props.

docs

validator: Function Custom validator function that takes the prop value as the sole argument. In a non-production environment, a console warning will be thrown if this function returns a falsy value (i.e. the validation fails).

alternatively, you could add custom validation either through a lifecycle hook like mounted or using a watch. The lifecycle method is OK if you know the prop values are not changing, if they are not static, then use a watch which is a more reliable solution.

👤Daniel

Leave a comment