mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +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 (features.layouts) { %>
|
||||
<% if (components.ErrorPage) { %>
|
||||
if (this.nuxt.err && NuxtError.layout) {
|
||||
this.setLayout(
|
||||
typeof NuxtError.layout === 'function'
|
||||
? NuxtError.layout(this.context)
|
||||
: NuxtError.layout
|
||||
)
|
||||
if (this.nuxt.err && NuxtError) {
|
||||
const errorLayout = (NuxtError.options || NuxtError).layout
|
||||
if (errorLayout) {
|
||||
this.setLayout(
|
||||
typeof errorLayout === 'function'
|
||||
? errorLayout.call(NuxtError, this.context)
|
||||
: errorLayout
|
||||
)
|
||||
}
|
||||
}
|
||||
<% } %>
|
||||
const layoutEl = h(this.layout || 'nuxt')
|
||||
|
@ -315,10 +315,11 @@ async function render (to, from, next) {
|
||||
|
||||
<% if (features.layouts) { %>
|
||||
// Load layout for error page
|
||||
const errorLayout = (NuxtError.options || NuxtError).layout
|
||||
const layout = await this.loadLayout(
|
||||
typeof NuxtError.layout === 'function'
|
||||
? NuxtError.layout(app.context)
|
||||
: NuxtError.layout
|
||||
typeof errorLayout === 'function'
|
||||
? errorLayout.call(NuxtError, app.context)
|
||||
: errorLayout
|
||||
)
|
||||
<% } %>
|
||||
|
||||
@ -523,7 +524,7 @@ async function render (to, from, next) {
|
||||
|
||||
<% if (features.layouts) { %>
|
||||
// Load error layout
|
||||
let layout = NuxtError.layout
|
||||
let layout = (NuxtError.options || NuxtError).layout
|
||||
if (typeof layout === 'function') {
|
||||
layout = layout(app.context)
|
||||
}
|
||||
@ -558,7 +559,7 @@ function showNextPage (to) {
|
||||
<% if (features.layouts) { %>
|
||||
// Set layout
|
||||
let layout = this.$options.nuxt.err
|
||||
? NuxtError.layout
|
||||
? (NuxtError.options || NuxtError).layout
|
||||
: to.matched[0].components.default.options.layout
|
||||
|
||||
if (typeof layout === 'function') {
|
||||
|
@ -88,7 +88,8 @@ export default async (ssrContext) => {
|
||||
const renderErrorPage = async () => {
|
||||
<% if (features.layouts) { %>
|
||||
// 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'
|
||||
await _app.loadLayout(errLayout)
|
||||
_app.setLayout(errLayout)
|
||||
|
Loading…
Reference in New Issue
Block a user