mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-18 14:41:25 +00:00
fix(vue-app): use nuxt globalName correctly in nuxt-link and fetch mixin (#8289)
This commit is contained in:
parent
e14b7201b4
commit
442b6c07c9
@ -111,8 +111,8 @@ export default {
|
|||||||
// Preload the data only if not in preview mode
|
// Preload the data only if not in preview mode
|
||||||
if (!this.$root.isPreview) {
|
if (!this.$root.isPreview) {
|
||||||
const { href } = this.$router.resolve(this.to, this.$route, this.append)
|
const { href } = this.$router.resolve(this.to, this.$route, this.append)
|
||||||
if (this.$nuxt)
|
if (this.<%= globals.nuxt %>)
|
||||||
this.$nuxt.fetchPayload(href).catch(() => {})
|
this.<%= globals.nuxt %>.fetchPayload(href).catch(() => {})
|
||||||
}
|
}
|
||||||
<% } %>
|
<% } %>
|
||||||
<% if (router.linkPrefetchedClass) { %>
|
<% if (router.linkPrefetchedClass) { %>
|
||||||
|
@ -60,12 +60,12 @@ function createdFullStatic() {
|
|||||||
if (typeof this.$options.fetchOnServer === 'function') {
|
if (typeof this.$options.fetchOnServer === 'function') {
|
||||||
fetchedOnServer = this.$options.fetchOnServer.call(this) !== false
|
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
|
return
|
||||||
}
|
}
|
||||||
this._hydrated = true
|
this._hydrated = true
|
||||||
this._fetchKey = this.$nuxt._payloadFetchIndex++
|
this._fetchKey = this.<%= globals.nuxt %>._payloadFetchIndex++
|
||||||
const data = this.$nuxt._pagePayload.fetch[this._fetchKey]
|
const data = this.<%= globals.nuxt %>._pagePayload.fetch[this._fetchKey]
|
||||||
|
|
||||||
// If fetch error
|
// If fetch error
|
||||||
if (data && data._error) {
|
if (data && data._error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user