Vue · Junior · Question 21 of 75
Which directives form a chain of conditions?
<p v-if="type === 'A'">A</p>
<p v-else-if="type === 'B'">B</p>
<p v-else>Other</p>- ✓Correct answer:
v-if,v-else-ifandv-elseon adjacent sibling elements - 2
v-if,v-elifandv-otherwise - 3Only
v-if; chains are not supported
Explanation
The v-else-if and v-else elements must immediately follow a v-if or v-else-if element. Wrap several elements in <template v-if> to toggle them as a group.