mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 23:22:02 +00:00
docs: add example of passing params to <NuxtLink>
(#27284)
This commit is contained in:
parent
a618a5c1d1
commit
9a33892cec
@ -25,6 +25,22 @@ In this example, we use `<NuxtLink>` component to link to another page of the ap
|
|||||||
</template>
|
</template>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Passing Params to Dynamic Routes
|
||||||
|
|
||||||
|
In this example, we pass the `id` param to link to the route `~/pages/posts/[id].vue`.
|
||||||
|
|
||||||
|
```vue [pages/index.vue]
|
||||||
|
<template>
|
||||||
|
<NuxtLink :to="{ name: 'posts-id', params: { id: 123 } }">
|
||||||
|
Post 123
|
||||||
|
</NuxtLink>
|
||||||
|
</template>
|
||||||
|
```
|
||||||
|
|
||||||
|
::tip
|
||||||
|
Check out the Pages panel in Nuxt DevTools to see the route name and the params it might take.
|
||||||
|
::
|
||||||
|
|
||||||
### Handling 404s
|
### Handling 404s
|
||||||
|
|
||||||
When using `<NuxtLink>` for `/public` directory files or when pointing to a different app on the same domain, you should use the `external` prop.
|
When using `<NuxtLink>` for `/public` directory files or when pointing to a different app on the same domain, you should use the `external` prop.
|
||||||
|
Loading…
Reference in New Issue
Block a user