Nuxt.js Examples

Rendering a Page

You can render a Nuxt page by using the <NuxtPage> component.

More ...

Layout for the App

You can set up a layout to be shared between the pages of your app.

More ...

Getting the Current Path

Use useRoute to get the path of the current page.

More ...

Dynamic Page Transition

Trigger a page transition dynamically with useRouter.

More ...

Fetch data with useFetch

You can fetch data from the server directly in the component.

More ...

Fetch data with custom logic

If you have custom fetching logic, you can wrap the logic inside useAsyncData.

More ...

The NuxtLink Component

Use <NuxtLink> to create a link between two pages as in a single-page app.

More ...

Route Validation

Validation logic can be registered for a route via definePageMeta.

More ...

Getting Route Params

The params of the route can be accessed through the useRoute composable.

More ...

The useState Composable

You can init a state on the server side using useState.

More ...

Setting <head> tags of a Page

You can set <title>, <meta>, and <link> with the useHead composable.

More ...

Render part of the page only on the client

You can opt out of Server-Side Rendering on the component level.

More ...

Preload Images

Use the preload attribute on <NuxtImg> to load images that you need to display immediately.

More ...

Client-Side Rendering

A Nuxt app can be configured to render entirely on the client side, just like a regular Vue.js app.

More ...

Client-Side Rendering

A Nuxt app can be generated entirely at build time.

More ...

Background Regeneration

A Nuxt app can be statically regenerated from time to time.

More ...

Server API Route

Create an API route with defineEventHandler.

More ...

Server Middleware

Different from route middleware, server middleware only executes on the server.

More ...

Querying Nuxt Content

Instead of using <ContentDoc>, you can also query the content you need.

More ...

SSG with Fallback

A middleware is a special function that gets executed before a route.

More ...

Inline-Middleware

A middleware can be also be created without an external file.

More ...

Render a Nuxt Content page

A Nuxt Content document can be rendered with the <NuxtContent> component.

More ...