Update README.md

This commit is contained in:
Sébastien Chopin 2016-11-25 18:20:07 +01:00 committed by GitHub
parent bcf291b547
commit fc25b2eaa8

View File

@ -7,6 +7,7 @@
`data` is called every time before loading the component (*only if attached to a route*). It can be called from the server-side or before navigating to the corresponding route. `data` is called every time before loading the component (*only if attached to a route*). It can be called from the server-side or before navigating to the corresponding route.
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 2 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 2 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. Define a second argument which is a callback method to be called like this: `callback(err, data)` 2. Define a second argument which is a callback method to be called like this: `callback(err, data)`