Update README.md

This commit is contained in:
Sébastien Chopin 2016-12-27 17:06:15 +01:00 committed by GitHub
parent 5d82cf3d68
commit 6cda84ed49

View File

@ -9,7 +9,7 @@
The `data` method receives the context as the first argument, you can use it to fetch some data and return the component data. To make the data method asynchronous, Nuxt.js offers you different ways, choose the one you're the most familiar with: The `data` method receives the context as the first argument, you can use it to fetch some data and return the component data. To make the data method asynchronous, Nuxt.js offers you different ways, choose the one you're the most familiar with:
1. returning a `Promise`, Nuxt.js will wait for the promise to be resolved before rendering the Component 1. returning a `Promise`, Nuxt.js will wait for the promise to be resolved before rendering the Component
2. Using the async/await ES7 feature 2. Using the ES7 `async` method with `await`
3. Define a second argument which is a callback method to be called like this: `callback(err, data)` 3. Define a second argument which is a callback method to be called like this: `callback(err, data)`
Example with returning a `Promise`: Example with returning a `Promise`: