s3e43 keeping track of elements when using v-for

This commit is contained in:
Tyrel Souza 2018-04-13 23:13:40 -04:00
parent a333938377
commit 1f9047ff09
No known key found for this signature in database
GPG Key ID: 5A9394D4C30AEAC0

View File

@ -8,10 +8,12 @@
<body>
<div id='app'>
<ul>
<li v-for="(ingredient, i) in ingredients">
<li v-for="(ingredient, i) in ingredients" :key="ingredient">
({{i+1}}) {{ ingredient }}
</li>
</ul>
<button @click="ingredients.push('spices')"> Add New</button>
<hr>
<template v-for="(ingredient, index) in ingredients">
<h1>{{ingredient}}</h1>