mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 15:22:39 +00:00
chore: minor fixes
This commit is contained in:
parent
a9f2f299a3
commit
518692b2f4
@ -279,10 +279,14 @@ async function render (to, from, next) {
|
|||||||
|
|
||||||
// Call fetch(context)
|
// Call fetch(context)
|
||||||
if (hasFetch) {
|
if (hasFetch) {
|
||||||
const promise = Component.options.fetch.call(_this, context).then(fetchResult => {
|
let p = Component.options.fetch.call(_this, context)
|
||||||
|
if (!p || (!(p instanceof Promise) && (typeof p.then !== 'function'))) {
|
||||||
|
p = Promise.resolve(p)
|
||||||
|
}
|
||||||
|
p.then(fetchResult => {
|
||||||
<% if(loading) { %>if(this.$loading.increase) this.$loading.increase(loadingIncrease)<% } %>
|
<% if(loading) { %>if(this.$loading.increase) this.$loading.increase(loadingIncrease)<% } %>
|
||||||
})
|
})
|
||||||
promises.push(promise)
|
promises.push(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.all(promises).then(() => {
|
return Promise.all(promises).then(() => {
|
||||||
@ -364,8 +368,10 @@ function fixPrepatch (to, ___) {
|
|||||||
}
|
}
|
||||||
this.setLayout(layout)
|
this.setLayout(layout)
|
||||||
|
|
||||||
|
<% if (isDev) { %>
|
||||||
// Hot reloading
|
// Hot reloading
|
||||||
setTimeout(() => hotReloadAPI(this), 100)
|
setTimeout(() => hotReloadAPI(this), 100)
|
||||||
|
<% } %>
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,6 +116,8 @@ async function createApp (ssrContext) {
|
|||||||
const _nuxt = this._nuxt || this.$options._nuxt
|
const _nuxt = this._nuxt || this.$options._nuxt
|
||||||
_nuxt.dateErr = Date.now()
|
_nuxt.dateErr = Date.now()
|
||||||
_nuxt.err = err
|
_nuxt.err = err
|
||||||
|
console.error(err)
|
||||||
|
console.error('[nuxt] ' + err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -81,12 +81,12 @@ export default async context => {
|
|||||||
// Resolve components
|
// Resolve components
|
||||||
let Components = []
|
let Components = []
|
||||||
try {
|
try {
|
||||||
Components = await Promise.all(getMatchedComponents(router.match(context.url)).map((Component) => new Promise((resolve, reject) => {
|
Components = await Promise.all(getMatchedComponents(router.match(context.url)).map(Component => {
|
||||||
if (typeof Component !== 'function' || Component.super === Vue) {
|
if (typeof Component !== 'function' || Component.super === Vue) {
|
||||||
return resolve(sanitizeComponent(Component))
|
return sanitizeComponent(Component)
|
||||||
}
|
}
|
||||||
return Component().then(Component => sanitizeComponent(Component))
|
return Component().then(Component => sanitizeComponent(Component))
|
||||||
})))
|
}))
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Throw back error to renderRoute()
|
// Throw back error to renderRoute()
|
||||||
throw err
|
throw err
|
||||||
|
Loading…
Reference in New Issue
Block a user