docs: update api example for pick (#22531)

This commit is contained in:
@beer 2023-08-08 15:59:35 +06:00 committed by GitHub
parent 53c706b575
commit a4d1ee226a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,7 +93,9 @@ If you have not fetched data on the server (for example, with `server: false`),
## Example ## Example
```ts ```ts
const { data, pending, error, refresh } = await useFetch('https://api.nuxtjs.dev/mountains',{ const route = useRoute()
const { data, pending, error, refresh } = await useFetch(`https://api.nuxtjs.dev/mountains/${route.params.slug}`, {
pick: ['title'] pick: ['title']
}) })
``` ```
@ -104,7 +106,7 @@ Using the `query` option, you can add search parameters to your query. This opti
```ts ```ts
const param1 = ref('value1') const param1 = ref('value1')
const { data, pending, error, refresh } = await useFetch('https://api.nuxtjs.dev/mountains',{ const { data, pending, error, refresh } = await useFetch('https://api.nuxtjs.dev/mountains', {
query: { param1, param2: 'value2' } query: { param1, param2: 'value2' }
}) })
``` ```