Skip to content

Commit a9bd047

Browse files
keng0oktsn
authored andcommitted
fix: Add key to v-for (#1369)
1 parent 0a04c46 commit a9bd047

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

examples/shopping-cart/components/ProductList.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<template>
22
<ul>
3-
<li v-for="product in products">
3+
<li
4+
v-for="product in products"
5+
:key="product.id">
46
{{ product.title }} - {{ product.price | currency }}
57
<br>
68
<button

examples/shopping-cart/components/ShoppingCart.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
<h2>Your Cart</h2>
44
<p v-show="!products.length"><i>Please add some products to cart.</i></p>
55
<ul>
6-
<li v-for="product in products">
6+
<li
7+
v-for="product in products"
8+
:key="product.id">
79
{{ product.title }} - {{ product.price | currency }} x {{ product.quantity }}
810
</li>
911
</ul>

0 commit comments

Comments
 (0)