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>

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.

Further reading

Problem with a question

Vue · Junior · question 21

Test yourself

Take the Vue · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz