Skip to content

Commit dc11c04

Browse files
committed
differentiate names of props and iterated var in intro's component example
1 parent 0e2023b commit dc11c04

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

src/v2/guide/index.md

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,7 @@ Now you can compose it in another component's template:
271271

272272
``` html
273273
<ul>
274-
<!--
275-
Create an instance of the todo-item component
276-
-->
274+
<!-- Create an instance of the todo-item component -->
277275
<todo-item></todo-item>
278276
</ul>
279277
```
@@ -295,11 +293,9 @@ Now we can pass the todo into each repeated component using `v-bind`:
295293
``` html
296294
<div id="app-7">
297295
<ol>
298-
<!--
299-
Now we provide each todo-item with the todo object
300-
it's representing, so that its content can be dynamic
301-
-->
302-
<todo-item v-for="todo in todos" v-bind:todo="todo"></todo-item>
296+
<!-- Now we provide each todo-item with the todo object -->
297+
<!-- it's representing, so that its content can be dynamic -->
298+
<todo-item v-for="item in groceryList" v-bind:todo="item"></todo-item>
303299
</ol>
304300
</div>
305301
```
@@ -308,21 +304,22 @@ Vue.component('todo-item', {
308304
props: ['todo'],
309305
template: '<li>{{ todo.text }}</li>'
310306
})
307+
311308
var app7 = new Vue({
312309
el: '#app-7',
313310
data: {
314-
todos: [
315-
{ text: 'Learn JavaScript' },
316-
{ text: 'Learn Vue' },
317-
{ text: 'Build something awesome' }
311+
groceryList: [
312+
{ text: 'Vegetables' },
313+
{ text: 'Cheese' },
314+
{ text: 'Whatever else humans are supposed to eat' }
318315
]
319316
}
320317
})
321318
```
322319
{% raw %}
323320
<div id="app-7" class="demo">
324321
<ol>
325-
<todo-item v-for="todo in todos" v-bind:todo="todo"></todo-item>
322+
<todo-item v-for="item in groceryList" v-bind:todo="item"></todo-item>
326323
</ol>
327324
</div>
328325
<script>
@@ -333,10 +330,10 @@ Vue.component('todo-item', {
333330
var app7 = new Vue({
334331
el: '#app-7',
335332
data: {
336-
todos: [
337-
{ text: 'Learn JavaScript' },
338-
{ text: 'Learn Vue' },
339-
{ text: 'Build something awesome' }
333+
groceryList: [
334+
{ text: 'Vegetables' },
335+
{ text: 'Cheese' },
336+
{ text: 'Whatever else humans are supposed to eat' }
340337
]
341338
}
342339
})

0 commit comments

Comments
 (0)