mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
fix(vue-app): layout in error.vue not work for Vue.extend component (#6650)
This commit is contained in:
parent
3948e606df
commit
afb38fe492
@ -37,12 +37,15 @@ export default {
|
|||||||
<% if (loading) { %>const loadingEl = h('NuxtLoading', { ref: 'loading' })<% } %>
|
<% if (loading) { %>const loadingEl = h('NuxtLoading', { ref: 'loading' })<% } %>
|
||||||
<% if (features.layouts) { %>
|
<% if (features.layouts) { %>
|
||||||
<% if (components.ErrorPage) { %>
|
<% if (components.ErrorPage) { %>
|
||||||
if (this.nuxt.err && NuxtError.layout) {
|
if (this.nuxt.err && NuxtError) {
|
||||||
this.setLayout(
|
const errorLayout = (NuxtError.options || NuxtError).layout
|
||||||
typeof NuxtError.layout === 'function'
|
if (errorLayout) {
|
||||||
? NuxtError.layout(this.context)
|
this.setLayout(
|
||||||
: NuxtError.layout
|
typeof errorLayout === 'function'
|
||||||
)
|
? errorLayout.call(NuxtError, this.context)
|
||||||
|
: errorLayout
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
<% } %>
|
<% } %>
|
||||||
const layoutEl = h(this.layout || 'nuxt')
|
const layoutEl = h(this.layout || 'nuxt')
|
||||||
|
@ -315,10 +315,11 @@ async function render (to, from, next) {
|
|||||||
|
|
||||||
<% if (features.layouts) { %>
|
<% if (features.layouts) { %>
|
||||||
// Load layout for error page
|
// Load layout for error page
|
||||||
|
const errorLayout = (NuxtError.options || NuxtError).layout
|
||||||
const layout = await this.loadLayout(
|
const layout = await this.loadLayout(
|
||||||
typeof NuxtError.layout === 'function'
|
typeof errorLayout === 'function'
|
||||||
? NuxtError.layout(app.context)
|
? errorLayout.call(NuxtError, app.context)
|
||||||
: NuxtError.layout
|
: errorLayout
|
||||||
)
|
)
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
@ -523,7 +524,7 @@ async function render (to, from, next) {
|
|||||||
|
|
||||||
<% if (features.layouts) { %>
|
<% if (features.layouts) { %>
|
||||||
// Load error layout
|
// Load error layout
|
||||||
let layout = NuxtError.layout
|
let layout = (NuxtError.options || NuxtError).layout
|
||||||
if (typeof layout === 'function') {
|
if (typeof layout === 'function') {
|
||||||
layout = layout(app.context)
|
layout = layout(app.context)
|
||||||
}
|
}
|
||||||
@ -558,7 +559,7 @@ function showNextPage (to) {
|
|||||||
<% if (features.layouts) { %>
|
<% if (features.layouts) { %>
|
||||||
// Set layout
|
// Set layout
|
||||||
let layout = this.$options.nuxt.err
|
let layout = this.$options.nuxt.err
|
||||||
? NuxtError.layout
|
? (NuxtError.options || NuxtError).layout
|
||||||
: to.matched[0].components.default.options.layout
|
: to.matched[0].components.default.options.layout
|
||||||
|
|
||||||
if (typeof layout === 'function') {
|
if (typeof layout === 'function') {
|
||||||
|
@ -88,7 +88,8 @@ export default async (ssrContext) => {
|
|||||||
const renderErrorPage = async () => {
|
const renderErrorPage = async () => {
|
||||||
<% if (features.layouts) { %>
|
<% if (features.layouts) { %>
|
||||||
// Load layout for error page
|
// Load layout for error page
|
||||||
const errLayout = (typeof NuxtError.layout === 'function' ? NuxtError.layout(app.context) : NuxtError.layout)
|
const layout = (NuxtError.options || NuxtError).layout
|
||||||
|
const errLayout = typeof layout === 'function' ? layout.call(NuxtError, app.context) : layout
|
||||||
ssrContext.nuxt.layout = errLayout || 'default'
|
ssrContext.nuxt.layout = errLayout || 'default'
|
||||||
await _app.loadLayout(errLayout)
|
await _app.loadLayout(errLayout)
|
||||||
_app.setLayout(errLayout)
|
_app.setLayout(errLayout)
|
||||||
|
Loading…
Reference in New Issue
Block a user