mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 06:05:11 +00:00
fix(vue-app): fallback to global nuxt instance of $root
is not available (#9008)
This commit is contained in:
parent
b602cfa2be
commit
c04a793b4a
@ -46,7 +46,11 @@ Vue.component(Nuxt.name, Nuxt)
|
||||
|
||||
Object.defineProperty(Vue.prototype, '<%= globals.nuxt %>', {
|
||||
get() {
|
||||
return this.$root.$options.<%= globals.nuxt %>
|
||||
const globalNuxt = this.$root.$options.<%= globals.nuxt %>
|
||||
if (process.client && !globalNuxt && typeof window !== 'undefined') {
|
||||
return window.<%= globals.nuxt %>
|
||||
}
|
||||
return globalNuxt
|
||||
},
|
||||
configurable: true
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user