Nuxt/docs/content/3.docs/2.directory-structure/15.app.md

42 lines
1.2 KiB
Markdown
Raw Normal View History

---
icon: IconFile
title: app.vue
head.title: App file
---
# App file
The `app.vue` file is the main component in your Nuxt 3 applications.
## Minimal usage
2021-11-21 12:31:44 +00:00
With Nuxt 3, the [`pages/`](/docs/directory-structure/pages) directory is optional. If not present, Nuxt won't include [vue-router](https://next.router.vuejs.org/) dependency. This is useful when working on a landing page or an application that does not need routing.
```vue [app.vue]
<template>
<h1>Hello World!</h1>
</template>
```
## Usage with pages
If you have a [`pages/`](/docs/directory-structure/pages) directory, to display the current page, use the `<NuxtPage>` component:
```vue [app.vue]
<template>
<div>
<NuxtPage/>
</div>
</template>
```
::alert{type=info}
Since Nuxt 3 uses [`<Suspense>`](https://v3.vuejs.org/guide/migration/suspense.html) inside `<NuxtPage>`, we recommend to wrap it into a single root element.
::
::alert{type=warning}
2021-11-21 12:31:44 +00:00
Remember that `app.vue` acts as the main component of your Nuxt application. Anything you add in it (JS and CSS) will be global and included in every page.
::
2021-11-21 12:31:44 +00:00
If you want to have the possibility to customize the structure around the page between pages, check out the [`layouts/`](/docs/directory-structure/layouts) directory.