mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 23:52:06 +00:00
Update README.md
This commit is contained in:
parent
bcf291b547
commit
fc25b2eaa8
@ -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)`
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user