I'm building a vuejs component which accepts a prop by the name of idFieldType
Now I want this prop to accept only a Number Type or a String Type
So I wrote it as follows
idFieldType: {
Type: Function,
default: function() {
return Number;
},
validator: function() {
if(value == String || value == Number) {
return true;
}
return false;
}
}
I also tried replacing the type to Object.
My question is how can I write a prop that accepts only specific types ?