s3e43 keeping track of elements when using v-for
This commit is contained in:
parent
a333938377
commit
1f9047ff09
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user