From 2bfb234505af54edc1b7cb3abdcd0ff6552f1862 Mon Sep 17 00:00:00 2001 From: Alexandre Chopin Date: Fri, 24 Mar 2017 15:47:14 +0100 Subject: [PATCH] add layout as function --- en/api/pages-layout.md | 8 ++++++-- en/guide/routing.md | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/en/api/pages-layout.md b/en/api/pages-layout.md index 5d28db248..9494cc260 100644 --- a/en/api/pages-layout.md +++ b/en/api/pages-layout.md @@ -7,13 +7,17 @@ description: Every file (first level) in the layouts directory will create a cus > Every file (first level) in the layouts directory will create a custom layout accessible with the layout property in the page component. -- **Type:** `String` (default: `'default'`) +- **Type:** `String` or `Function` (default: `'default'`) Use the `layout` key in your pages components to define which layout to use: ```js export default { - layout: 'blog' + layout: 'blog', + // OR + layout (context) { + return 'blog' + } } ``` diff --git a/en/guide/routing.md b/en/guide/routing.md index 167ef2adb..628af2979 100644 --- a/en/guide/routing.md +++ b/en/guide/routing.md @@ -111,7 +111,7 @@ More information about the validate method: [API Pages validate](/api/pages-vali Nuxt.js lets you create nested route by using the children routes of vue-router. -To define a nested route, you need to create a Vue file with the **same name as the directory** which contain your children views. +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.

Don't forget to write `` inside the parent component (.vue file).