Skip to content

Commit 3ed6368

Browse files
committed
item in array syntax
1 parent 8971c66 commit 3ed6368

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

source/api/directives.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,16 @@ If an argument is provided, a wrapper data object will always be created, using
185185
</ul>
186186
```
187187

188+
Starting in 0.12.8, a special alternative is available to make the syntax more natural:
189+
190+
``` html
191+
<ul>
192+
<li v-repeat="user in users">
193+
{{user.name}} {{user.email}}
194+
</li>
195+
</ul>
196+
```
197+
188198
For detailed examples, see [Displaying a List](/guide/list.html).
189199

190200
## Literal Directives

source/guide/list.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,13 @@ new Vue({
8989
})
9090
</script>
9191

92-
## Using an identifier
92+
## Using an alias
9393

94-
Sometimes we might want to have more explicit variable access instead of implicitly falling back to parent scope. You can do that by providing an argument to the `v-repeat` directive and use it as the identifier for the item being iterated:
94+
Sometimes we might want to have more explicit variable access instead of implicitly falling back to parent scope. You can do that by providing an alias to the `v-repeat` directive and use it as the alias for the item being iterated:
9595

9696
``` html
9797
<ul id="users">
98-
<!-- think of this as "for each user in users" -->
99-
<li v-repeat="user: users">
98+
<li v-repeat="user in users">
10099
{{user.name}} - {{user.email}}
101100
</li>
102101
</ul>
@@ -128,7 +127,9 @@ new Vue({
128127
})
129128
</script>
130129

131-
<p class="tip">Using an identifier with `v-repeat` in general results in more readable templates and slightly better performance.</p>
130+
<p class="tip">The `user in users` syntax is only available in Vue 0.12.8 and above. For older versions, you must use the `user : users` syntax.</p>
131+
132+
<p class="tip">Using an alias with `v-repeat` in general results in more readable templates and slightly better performance.</p>
132133

133134
## Mutation Methods
134135

0 commit comments

Comments
 (0)