Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit 2bfb234

Browse files
committed
add layout as function
1 parent be36811 commit 2bfb234

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

en/api/pages-layout.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@ description: Every file (first level) in the layouts directory will create a cus
77

88
> Every file (first level) in the layouts directory will create a custom layout accessible with the layout property in the page component.
99
10-
- **Type:** `String` (default: `'default'`)
10+
- **Type:** `String` or `Function` (default: `'default'`)
1111

1212
Use the `layout` key in your pages components to define which layout to use:
1313

1414
```js
1515
export default {
16-
layout: 'blog'
16+
layout: 'blog',
17+
// OR
18+
layout (context) {
19+
return 'blog'
20+
}
1721
}
1822
```
1923

en/guide/routing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ More information about the validate method: [API Pages validate](/api/pages-vali
111111

112112
Nuxt.js lets you create nested route by using the children routes of vue-router.
113113

114-
To define a nested route, you need to create a Vue file with the **same name as the directory** which contain your children views.
114+
To define the parent component of a nested route, you need to create a Vue file with the **same name as the directory** which contain your children views.
115115

116116
<p class="Alert Alert--info">Don't forget to write `<nuxt-child/>` inside the parent component (.vue file).</p>
117117

0 commit comments

Comments
 (0)