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:
- <template v-for="item in items" :key="item.id">
- <div v-if="item.isActive">
- {{ item.name }}</div>
- </template>