mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
Use nuxtChildKey as computed by default
This commit is contained in:
parent
a869637615
commit
a963b566c1
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<nuxt-error v-if="nuxt.err" :error="nuxt.err"></nuxt-error>
|
||||
<nuxt-child :key="routerViewKey" v-else></nuxt-child>
|
||||
<nuxt-child :key="nuxtChildKey" v-else></nuxt-child>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@ -46,6 +46,15 @@ export default {
|
||||
}
|
||||
},
|
||||
<% } %>
|
||||
computed: {
|
||||
nuxtChildKey () {
|
||||
// If routerViewKey prop is given or current route has children
|
||||
if (typeof this.routerViewKey !== 'undefined' || this.$route.matched.length > 1) {
|
||||
return this.routerViewKey || ''
|
||||
}
|
||||
return this.$route.fullPath.split('#')[0]
|
||||
}
|
||||
},
|
||||
components: {
|
||||
NuxtChild,
|
||||
NuxtError
|
||||
|
Loading…
Reference in New Issue
Block a user