fix(vue-app): use nuxt globalName correctly in nuxt-link and fetch mixin (#8289)

This commit is contained in:
Daniel Roe 2020-11-04 13:35:29 +00:00 committed by GitHub
parent e14b7201b4
commit 442b6c07c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -111,8 +111,8 @@ export default {
// Preload the data only if not in preview mode
if (!this.$root.isPreview) {
const { href } = this.$router.resolve(this.to, this.$route, this.append)
if (this.$nuxt)
this.$nuxt.fetchPayload(href).catch(() => {})
if (this.<%= globals.nuxt %>)
this.<%= globals.nuxt %>.fetchPayload(href).catch(() => {})
}
<% } %>
<% if (router.linkPrefetchedClass) { %>

View File

@ -60,12 +60,12 @@ function createdFullStatic() {
if (typeof this.$options.fetchOnServer === 'function') {
fetchedOnServer = this.$options.fetchOnServer.call(this) !== false
}
if (!fetchedOnServer || this.$nuxt.isPreview || !this.$nuxt._pagePayload) {
if (!fetchedOnServer || this.<%= globals.nuxt %>.isPreview || !this.<%= globals.nuxt %>._pagePayload) {
return
}
this._hydrated = true
this._fetchKey = this.$nuxt._payloadFetchIndex++
const data = this.$nuxt._pagePayload.fetch[this._fetchKey]
this._fetchKey = this.<%= globals.nuxt %>._payloadFetchIndex++
const data = this.<%= globals.nuxt %>._pagePayload.fetch[this._fetchKey]
// If fetch error
if (data && data._error) {