Answer the question
In order to leave comments, you need to log in
Vue - object validation in props?
I'm looking for the same visual way as in React
. For example, checking that myObject is an object from {color: ... fontSize: ...},
myObject: PropTypes.shape({
color: PropTypes.string,
fontSize: PropTypes.number
})
validator(obj) {
return (obj.id && Number.isInteger(obj.id) && obj.name && obj.name.length );
}
Answer the question
In order to leave comments, you need to log in
Validation of input parameters
Validation of UPDRemoved from comments.
I saw the solution through the validator function, but it does not seem optimal to me for objects. At least in React, it's much shorter and cleaner.
Is there an equivalent in Vue?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question