fix: Fix Cannot read property 'components' of undefined

This commit is contained in:
Atinux 2017-11-16 13:22:45 +01:00
parent ece3fe84dc
commit 4b79c38f41

View File

@ -29,7 +29,7 @@ export default {
if (typeof this.nuxtChildKey !== 'undefined' || this.$route.matched.length > 1) {
return this.nuxtChildKey || compile(this.$route.matched[0].path)(this.$route.params)
}
const Component = this.$route.matched[0].components.default
const Component = this.$route.matched[0] && this.$route.matched[0].components.default
if (Component && Component.options && Component.options.key) {
return (typeof Component.options.key === 'function' ? Component.options.key(this.$route) : Component.options.key)
}