Skip to content

Commit a6617da

Browse files
committed
add undocumented range feature of v-repeat
1 parent 5638e98 commit a6617da

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

source/guide/list.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,31 @@ new Vue({
236236

237237
<p class="tip">In ECMAScript 5 there is no way to detect when a new property is added to an Object, or when a property is deleted from an Object. To deal with that, observed objects will be augmented with two methods: `$add(key, value)` and `$delete(key)`. These methods can be used to add / delete properties from observed objects while triggering the desired View updates.</p>
238238

239+
## Iterating Through An Object
240+
241+
`v-repeat` can also take a whole Number. In this case it will repeat the template that many times.
242+
243+
``` html
244+
<div id="range">
245+
<div v-repeat="val">Hi!</div>
246+
</div>
247+
```
248+
249+
``` js
250+
new Vue({
251+
el: '#range',
252+
data: {val:3}
253+
});
254+
```
255+
**Result:**
256+
<ul id="range" class="demo"><div v-repeat="val">Hi!</div></ul>
257+
<script>
258+
new Vue({
259+
el: '#app',
260+
data: {val:3}
261+
});
262+
</script>
263+
239264
## Array Filters
240265

241266
Sometimes we only need to display a filtered or sorted version of the Array without actually mutating or resetting the original data. Vue provides two built-in filters to simplify such usage: `filterBy` and `orderBy`. Check out their [documentations](/api/filters.html#filterBy) for more details.

0 commit comments

Comments
 (0)