mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-07 09:22:27 +00:00
chore(nuxt-error): use computed
This commit is contained in:
parent
400363860a
commit
2efa394529
@ -4,10 +4,10 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<h1>{{ error.statusCode }} </h1>
|
<h1>{{ statusCode }} </h1>
|
||||||
<h4> {{ error.message }} </h4>
|
<h4> {{ message }} </h4>
|
||||||
<%if(debug){%><pre class="error-box"><code>URI: {{ $route.path }}<br>{{ error.stack }}</code></pre><%}%>
|
<%if(debug){%><pre class="error-box"><code>URI: {{ $route.path }}<br>{{ error.stack }}</code></pre><%}%>
|
||||||
<p v-if="error.statusCode === 404 || error.statusCode === 'Whoops!'">
|
<p v-if="statusCode === 404">
|
||||||
<nuxt-link class="error-link" to="/">Back to the home page</nuxt-link>
|
<nuxt-link class="error-link" to="/">Back to the home page</nuxt-link>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@ -31,12 +31,20 @@ export default {
|
|||||||
props: ['error'],
|
props: ['error'],
|
||||||
head () {
|
head () {
|
||||||
return {
|
return {
|
||||||
title: this.error ? ((this.error.statusCode || 500) + ' - ' + (this.error.message || 'Nuxt Server Error')) : '500 - Nuxt Server Error',
|
title: this.statusCode + ' - ' + this.message,
|
||||||
link: [
|
link: [
|
||||||
{ rel: 'stylesheet', href: 'https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css', type: 'text/css', media: 'all' },
|
{ rel: 'stylesheet', href: 'https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css', type: 'text/css', media: 'all' },
|
||||||
{ rel: 'stylesheet', href: 'https://cdnjs.cloudflare.com/ajax/libs/milligram/1.3.0/milligram.min.css', type: 'text/css', media: 'all' }
|
{ rel: 'stylesheet', href: 'https://cdnjs.cloudflare.com/ajax/libs/milligram/1.3.0/milligram.min.css', type: 'text/css', media: 'all' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
statusCode () {
|
||||||
|
return (this.error && this.error.statusCode) || 500
|
||||||
|
},
|
||||||
|
message () {
|
||||||
|
return (this.error && this.error.message) || 'Nuxt Server Error'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user