I am currently developing a Vue component that is required to accept either text input or a link. When a link is provided, an anchor tag needs to be created and when text is inputted, a span should be generated. The issue I am facing is that it seems each Vue prop has its own validator, as seen in the following code:
url: {
type: String,
required: true
},
text: {
type: String
}
The above code does not meet my requirements because it mandates the presence of url even if only text is passed.
How can I modify the component so that it can accept either a url or text as mandatory input?
Additionally, how can I ensure the component only accepts one type of input, failing if both URL and text are provided?