<!-- Component changes when currentTabComponent changes -->
<component v-bind:is="currentTabComponent"></component>
<div v-if="type === 'A'">
A
</div>
<div v-else-if="type === 'B'">
B
</div>
<div v-else-if="type === 'C'">
C
</div>
<div v-else>
Not A/B/C
</div>
I know the different between using v-if
and v-show
, but I don't know the difference between using a list of v-if
s for different cases vs using the is
special attribute. When should I use them?
is
would be useful if the list ofv-if
s would all render a component if true.像这样:
然后可以将其简化为: