Skip to content
This repository was archived by the owner on Dec 26, 2018. It is now read-only.

Commit 6e96d6f

Browse files
committed
readme
1 parent 75622d7 commit 6e96d6f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,22 @@ Vue.component('example', {
4242
})
4343
```
4444

45-
You can also return a promise that resolves to the data to be set:
45+
You can also return a promise that resolves to the data to be set (plays well with [vue-resource](https://github.com/vuejs/vue-resource)):
4646

4747
``` js
4848
Vue.component('example', {
4949
// ...
5050
asyncData: function () {
51+
var self = this
5152
return someServiceThatReturnsPromise.get(12345)
5253
.then(function (msg) {
54+
// returning this as the Promise's resolve value
55+
// will call `vm.$set('msg', msg)` for you
5356
return {
5457
msg: msg
5558
}
59+
// or, set it yourself:
60+
// self.msg = msg
5661
})
5762
}
5863
})

0 commit comments

Comments
 (0)