Skip to content

Commit 7b44131

Browse files
committed
fix orderBy example
1 parent 6b70a31 commit 7b44131

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

source/api/index.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1940,14 +1940,16 @@ type: api
19401940

19411941
Return a sorted version of the source Array. The `sortKey` is the key to use for the sorting. The optional `order` argument specifies whether the result should be in ascending (`order >= 0`) or descending (`order < 0`) order.
19421942

1943+
For arrays of primitive values, any truthy `sortKey` will work.
1944+
19431945
- **Example:**
19441946

19451947
Sort users by name:
19461948

19471949
``` html
19481950
<ul>
1949-
<li v-repeat="user in users | orderBy 'name'">
1950-
{{user.name}}
1951+
<li v-for="user in users | orderBy 'name'">
1952+
{{ user.name }}
19511953
</li>
19521954
</ul>
19531955
```
@@ -1956,8 +1958,18 @@ type: api
19561958

19571959
``` html
19581960
<ul>
1959-
<li v-repeat="user in users | orderBy 'name' -1">
1960-
{{user.name}}
1961+
<li v-for="user in users | orderBy 'name' -1">
1962+
{{ user.name }}
1963+
</li>
1964+
</ul>
1965+
```
1966+
1967+
Sort primitive values:
1968+
1969+
``` html
1970+
<ul>
1971+
<li v-for="n in numbers | orderBy true">
1972+
{{ n }}
19611973
</li>
19621974
</ul>
19631975
```

0 commit comments

Comments
 (0)