Click in order · Vue.js course · Module 2: Template Syntax

v-for Syntax with Template Wrapper

Arrange the correct usage of a template wrapper with v-for and v-if:

Items to click

  • <div v-if="item.isActive">
  • {{ item.name }}</div>
  • </template>
  • <template v-for="item in items" :key="item.id">
Show the answer

Correct order:

  1. <template v-for="item in items" :key="item.id">
  2. <div v-if="item.isActive">
  3. {{ item.name }}</div>
  4. </template>