Merge pull request #1209 from silverbackdan/patch-1

Improved default key for page with children
This commit is contained in:
Sébastien Chopin 2017-08-01 15:34:36 +02:00 committed by GitHub
commit 1165713b82

View File

@ -7,6 +7,7 @@
import Vue from 'vue' import Vue from 'vue'
import NuxtChild from './nuxt-child' import NuxtChild from './nuxt-child'
import NuxtError from '<%= components.ErrorPage ? ((components.ErrorPage.includes('~') || components.ErrorPage.includes('@')) ? components.ErrorPage : "../" + components.ErrorPage) : "./nuxt-error.vue" %>' import NuxtError from '<%= components.ErrorPage ? ((components.ErrorPage.includes('~') || components.ErrorPage.includes('@')) ? components.ErrorPage : "../" + components.ErrorPage) : "./nuxt-error.vue" %>'
import { compile } from '../utils'
export default { export default {
name: 'nuxt', name: 'nuxt',
@ -50,7 +51,7 @@ export default {
routerViewKey () { routerViewKey () {
// If nuxtChildKey prop is given or current route has children // If nuxtChildKey prop is given or current route has children
if (typeof this.nuxtChildKey !== 'undefined' || this.$route.matched.length > 1) { if (typeof this.nuxtChildKey !== 'undefined' || this.$route.matched.length > 1) {
return this.nuxtChildKey || '' return this.nuxtChildKey || compile(this.$route.matched[0].path)(this.$route.params)
} }
return this.$route.fullPath.split('#')[0] return this.$route.fullPath.split('#')[0]
} }