mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 15:22:39 +00:00
Rename routerViewKey to nuxtChildKey
This commit is contained in:
parent
fc2c780dd0
commit
ad85582f5c
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<nuxt-error v-if="nuxt.err" :error="nuxt.err"></nuxt-error>
|
<nuxt-error v-if="nuxt.err" :error="nuxt.err"></nuxt-error>
|
||||||
<nuxt-child :key="nuxtChildKey" v-else></nuxt-child>
|
<nuxt-child :key="routerViewKey" v-else></nuxt-child>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -10,7 +10,7 @@ import NuxtError from '<%= components.ErrorPage ? ((components.ErrorPage.include
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'nuxt',
|
name: 'nuxt',
|
||||||
props: ['routerViewKey'],
|
props: ['nuxtChildKey'],
|
||||||
beforeCreate () {
|
beforeCreate () {
|
||||||
Vue.util.defineReactive(this, 'nuxt', this.$root.$options._nuxt)
|
Vue.util.defineReactive(this, 'nuxt', this.$root.$options._nuxt)
|
||||||
},
|
},
|
||||||
@ -47,10 +47,10 @@ export default {
|
|||||||
},
|
},
|
||||||
<% } %>
|
<% } %>
|
||||||
computed: {
|
computed: {
|
||||||
nuxtChildKey () {
|
routerViewKey () {
|
||||||
// If routerViewKey prop is given or current route has children
|
// If nuxtChildKey prop is given or current route has children
|
||||||
if (typeof this.routerViewKey !== 'undefined' || this.$route.matched.length > 1) {
|
if (typeof this.nuxtChildKey !== 'undefined' || this.$route.matched.length > 1) {
|
||||||
return this.routerViewKey || ''
|
return this.nuxtChildKey || ''
|
||||||
}
|
}
|
||||||
return this.$route.fullPath.split('#')[0]
|
return this.$route.fullPath.split('#')[0]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user