Skip to content
This repository was archived by the owner on Apr 6, 2023. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions docs/content/2.guide/3.directory-structure/10.pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,35 @@ Pages are Vue components and can have the `.vue`, `.js`, `.jsx`, `.ts` or `.tsx`
::code-group

```vue [pages/index.vue]
<script lang="tsx" setup>
const welcome = () => {
return <span>Welcome </span>
};
const nuxt3 = () => {
return <span>nuxt3</span>
};
const content = () => {
return (
<div>
{welcome()}
<span>to </span>
{nuxt3()}
</div>
);
};
</script>
<template>
<h1>Index page</h1>
<div>
<content />
</div>
</template>
```

```ts [pages/index.ts]
// https://vuejs.org/guide/extras/render-function.html
export default defineComponent({
render () {
return h('h1', 'Index page')
return h('h1', 'Welcome to nuxt3')
}
})
```
Expand All @@ -37,11 +56,13 @@ export default defineComponent({
// https://vuejs.org/guide/extras/render-function.html#jsx-tsx
export default defineComponent({
render () {
return <h1>Index page</h1>
return <h1>Welcome to nuxt3</h1>
}
})
```

- `index.vue`: `window` can be used in functional components, and does not need to do `process.client` judgment

::

The `pages/index.vue` file will be mapped to the `/` route of your application.
Expand Down