mirror of
https://github.com/nuxt/nuxt.git
synced 2024-12-04 11:27:13 +00:00
add component options to context
This commit is contained in:
parent
127155d61a
commit
77e069ae27
@ -33,7 +33,7 @@ NUXT.components = window.__COMPONENTS__ || null
|
|||||||
const defaultErrorHandler = Vue.config.errorHandler
|
const defaultErrorHandler = Vue.config.errorHandler
|
||||||
Vue.config.errorHandler = function (err, vm, info) {
|
Vue.config.errorHandler = function (err, vm, info) {
|
||||||
err.statusCode = err.statusCode || 'Whoops!'
|
err.statusCode = err.statusCode || 'Whoops!'
|
||||||
|
|
||||||
// Show Nuxt Error Page
|
// Show Nuxt Error Page
|
||||||
if(vm && vm.$root && vm.$root.$nuxt) {
|
if(vm && vm.$root && vm.$root.$nuxt) {
|
||||||
vm.$root.$nuxt.error(err)
|
vm.$root.$nuxt.error(err)
|
||||||
@ -300,7 +300,9 @@ async function render (to, from, next) {
|
|||||||
|
|
||||||
// Call fetch(context)
|
// Call fetch(context)
|
||||||
if (hasFetch) {
|
if (hasFetch) {
|
||||||
let p = Component.options.fetch(context)
|
let p = Component.options.fetch({
|
||||||
|
...context, options: Component.options
|
||||||
|
})
|
||||||
if (!p || (!(p instanceof Promise) && (typeof p.then !== 'function'))) {
|
if (!p || (!(p instanceof Promise) && (typeof p.then !== 'function'))) {
|
||||||
p = Promise.resolve(p)
|
p = Promise.resolve(p)
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,9 @@ export default async context => {
|
|||||||
|
|
||||||
// Call fetch(context)
|
// Call fetch(context)
|
||||||
if (Component.options.fetch) {
|
if (Component.options.fetch) {
|
||||||
promises.push(Component.options.fetch(ctx))
|
promises.push(Component.options.fetch({
|
||||||
|
...ctx, options: Component.options
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
promises.push(null)
|
promises.push(null)
|
||||||
|
Loading…
Reference in New Issue
Block a user