Nuxt.js Examples
Fetch data with custom logic
If you have custom fetching logic, you can wrap the logic inside useAsyncData
.
The NuxtLink Component
Use <NuxtLink>
to create a link between two pages as in a single-page app.
Getting Route Params
The params of the route can be accessed through the useRoute
composable.
Setting <head> tags of a Page
You can set <title>
, <meta>
, and <link>
with the useHead
composable.
Render part of the page only on the client
You can opt out of Server-Side Rendering on the component level.
Preload Images
Use the preload
attribute on <NuxtImg>
to load images that you need to display immediately.
Client-Side Rendering
A Nuxt app can be configured to render entirely on the client side, just like a regular Vue.js app.
Server Middleware
Different from route middleware, server middleware only executes on the server.
Querying Nuxt Content
Instead of using <ContentDoc>
, you can also query the content you need.
Render a Nuxt Content page
A Nuxt Content document can be rendered with the <NuxtContent>
component.