Skip to content

Commit

Permalink
fix: update async example (#633)
Browse files Browse the repository at this point in the history
* Update Treeview.json

* Update directory.vue
  • Loading branch information
nekosaur authored and johnleider committed Oct 25, 2018
1 parent c54013d commit 7dc388a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/examples/treeview/directory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@
},
methods: {
async fetchUsers () {
async fetchUsers (item) {
// Remove in 6 months and say
// you've made optimizations! :)
await pause(1500)
fetch('https://jsonplaceholder.typicode.com/users')
return fetch('https://jsonplaceholder.typicode.com/users')
.then(res => res.json())
.then(json => (this.users = json))
.then(json => (item.children.push(...json)))
.catch(err => console.warn(err))
},
randomAvatar () {
Expand Down
2 changes: 1 addition & 1 deletion src/lang/en/components/Treeview.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"directory": {
"header": "Async items",
"desc": "Save requests by supplying a _Promise_ callback and load your data only if/when you need it"
"desc": "You can dynamically load child data by supplying a _Promise_ callback to the `load-children` prop. This callback will be executed the first time a user tries to expand an item that has a children property that is an empty array."
},
"hotspots": {
"header": "Custom selectable icons",
Expand Down

0 comments on commit 7dc388a

Please sign in to comment.