2👍
you can use computed
to replace it
props: {
variant : String
},
computed: {
computedVariant() {
return this.variant.length > 1 ?
[this.variant] :
this.variant
}
}
then use the computedVariant
instead of variant
in your template
<div>{{ computedVariant }}</div>
Source:stackexchange.com