Imagine you have a component called MyComponent
with a prop named myProp
declared as:
props: {
myProp: Boolean
}
By simply using <MyComponent myProp/>
, the default behavior would set myProp
to true
.
However, this simplicity is lost when there are multiple types allowed for myProp
.
For example,
props: {
myProp: [Object, String, Boolean]
}
So how can the default behavior be retained when adding the myProp
attribute without specifying an explicit value?