mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-16 21:58:19 +00:00
docs(api): add key
option for useFetch
(#5089)
Co-authored-by: Sébastien Chopin <seb@nuxtjs.com>
This commit is contained in:
parent
aace553f1a
commit
7b3dc6ec5d
@ -11,6 +11,7 @@ function useFetch(
|
|||||||
): Promise<DataT>
|
): Promise<DataT>
|
||||||
|
|
||||||
type UseFetchOptions = {
|
type UseFetchOptions = {
|
||||||
|
key?: string,
|
||||||
method?: string,
|
method?: string,
|
||||||
params?: SearchParams,
|
params?: SearchParams,
|
||||||
body?: RequestInit['body'] | Record<string, any>
|
body?: RequestInit['body'] | Record<string, any>
|
||||||
@ -41,6 +42,7 @@ type DataT = {
|
|||||||
* `headers`: Request headers
|
* `headers`: Request headers
|
||||||
* `baseURL`: Base URL for the request
|
* `baseURL`: Base URL for the request
|
||||||
* **Options (from `useAsyncData`)**:
|
* **Options (from `useAsyncData`)**:
|
||||||
|
* `key`: a unique key to ensure that data fetching can be properly de-duplicated across requests, if not provided, it will be generated based on the `url` and fetch options
|
||||||
* `lazy`: Whether to resolve the async function after loading the route, instead of blocking navigation (defaults to `false`).
|
* `lazy`: Whether to resolve the async function after loading the route, instead of blocking navigation (defaults to `false`).
|
||||||
* `server`: Whether to fetch the data on the server (defaults to `true`).
|
* `server`: Whether to fetch the data on the server (defaults to `true`).
|
||||||
* `default`: A factory function to set the default value of the data, before the async function resolves - particularly useful with the `lazy: true` option.
|
* `default`: A factory function to set the default value of the data, before the async function resolves - particularly useful with the `lazy: true` option.
|
||||||
|
Loading…
Reference in New Issue
Block a user