Is there a way to create custom prop types (and extend it with validation) for Vue.js props?
In the below example you'll find the Object prop background. Instead of an Object, I would like to have a custom prop type Image.
Image would check if src and alt are filled, rest would be optional.
What we have now:
export default {
props: {
background: {
type: Object,
src: String,
srcset: String,
alt: String,
title: String,
},
},
};
What I'd like to have:
class customPropImage {
// magic ...
}
export default {
props: {
background: Image,
},
};