File tree Expand file tree Collapse file tree 4 files changed +24
-0
lines changed
packages/vue-app/template Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 6
6
globalHandleError
7
7
} from './utils'
8
8
< % } % >
9
+ < % if ( features . layouts && components . ErrorPage ) { % > import NuxtError from '<%= components.ErrorPage %>' < % } % >
9
10
< % if ( loading ) { % > import NuxtLoading from '<%= (typeof loading === "string" ? loading : "./components/nuxt-loading.vue") %>' < % } % >
10
11
< % if ( buildIndicator ) { % > import NuxtBuildIndicator from './components/nuxt-build-indicator' < % } % >
11
12
< % css . forEach ( ( c ) => { % >
@@ -35,6 +36,15 @@ export default {
35
36
render ( h , props ) {
36
37
< % if ( loading ) { % > const loadingEl = h ( 'NuxtLoading' , { ref : 'loading' } ) < % } % >
37
38
< % if ( features . layouts ) { % >
39
+ < % if ( components . ErrorPage ) { % >
40
+ if ( this . nuxt . err && NuxtError . layout ) {
41
+ this . setLayout (
42
+ typeof NuxtError . layout === 'function'
43
+ ? NuxtError . layout ( this . context )
44
+ : NuxtError . layout
45
+ )
46
+ }
47
+ < % } % >
38
48
const layoutEl = h(this.layout || 'nuxt')
39
49
const templateEl = h('div', {
40
50
domProps : {
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ describe('basic browser', () => {
32
32
test ( '/squared doesnt loop due to error on error page' , async ( ) => {
33
33
await page . nuxt . navigate ( '/squared' )
34
34
35
+ expect ( await page . $text ( 'header' ) ) . toBe ( 'Error layout' )
35
36
expect ( await page . $text ( 'h2' ) ) . toBe ( 'An error occured while showing the error page' )
36
37
} )
37
38
Original file line number Diff line number Diff line change
1
+ <template >
2
+ <div >
3
+ <header >Error layout</header >
4
+ <nuxt />
5
+ </div >
6
+ </template >
7
+
8
+ <script >
9
+ export default {
10
+ name: ' ErrorLayout'
11
+ }
12
+ </script >
Original file line number Diff line number Diff line change 11
11
12
12
<script >
13
13
export default {
14
+ layout: ' error-layout' ,
14
15
// eslint-disable-next-line vue/require-prop-types
15
16
props: [' error' ]
16
17
}
You can’t perform that action at this time.
0 commit comments