Complete the code to render a list of items using v-for.
<ul> <li v-for="item in [1]" :key="item.id">{{ item.name }}</li> </ul>
The v-for directive loops over the array named items to render each item.
Complete the code to include the index when rendering the list with v-for.
<ul> <li v-for="(item, [1]) in items" :key="item.id">{{ index + 1 }}. {{ item.name }}</li> </ul>
v-for syntax.The second variable in v-for is the index, commonly named index.
Fix the error in the v-for syntax to correctly render the list.
<ul> <li v-for="item [1] items" :key="item.id">{{ item.name }}</li> </ul>
of instead of in in v-for.The correct syntax for v-for uses in to loop over an array.
Fill both blanks to render a list of users with their index and unique key.
<ul> <li v-for="(user, [1]) in [2]" :key="user.id">{{ index + 1 }}. {{ user.name }}</li> </ul>
The index variable is index and the array is users.
Fill all three blanks to render a list of products showing their uppercase names and filtering only available ones.
<ul> <li v-for="(product, [1]) in products.filter(p => p.available)" :key="[2]">{{ product.[3] }}</li> </ul>
The index variable is i, the key is product.id, and the displayed name is the uppercase version using name.toUpperCase().