fix(vue-app): null check for $root access (#9150)

Co-authored-by: Payel <payelk@ngdata.com>
This commit is contained in:
Payel Karmakar 2021-08-11 20:02:35 +05:30 committed by GitHub
parent 4a95333a13
commit 20e7b99eb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,7 +46,7 @@ Vue.component(Nuxt.name, Nuxt)
Object.defineProperty(Vue.prototype, '<%= globals.nuxt %>', {
get() {
const globalNuxt = this.$root.$options.<%= globals.nuxt %>
const globalNuxt = this.$root ? this.$root.$options.<%= globals.nuxt %> : null
if (process.client && !globalNuxt && typeof window !== 'undefined') {
return window.<%= globals.nuxt %>
}