I have the following
<tabs>
//If tab.name is not null
<tab v-for="tab in tabs" :key="tab.id" :name="tab.name" :suffix="tab.id">
</tab>
//If tab.name is null
<tab v-for="tab in tabs" :key="tab.id" :name="tab.id">
</tab>
</tabs>
I want to run a loop for my data and render the component differently based on my condition.
I can't for the life of me figure out how to do that. v-else
requires another element declaration, but if you put v-for
in both it will just run the loop twice. I tried this but it doesnt seem to work in my case. If I do <template :name="tab.name">
the component says it's missing the required property name
.
How is this supposed to work in vue?