nuxt-error.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <div class="__nuxt-error-page">
  3. <div class="error">
  4. <svg xmlns="http://www.w3.org/2000/svg" width="90" height="90" fill="#DBE1EC" viewBox="0 0 48 48">
  5. <path d="M22 30h4v4h-4zm0-16h4v12h-4zm1.99-10C12.94 4 4 12.95 4 24s8.94 20 19.99 20S44 35.05 44 24 35.04 4 23.99 4zM24 40c-8.84 0-16-7.16-16-16S15.16 8 24 8s16 7.16 16 16-7.16 16-16 16z" />
  6. </svg>
  7. <div class="title">{{ message }}</div>
  8. <p v-if="statusCode === 404" class="description">
  9. <a v-if="typeof $route === 'undefined'" class="error-link" href="/"></a>
  10. <NuxtLink v-else class="error-link" to="/">Back to the home page</NuxtLink>
  11. </p>
  12. <p class="description" v-else>An error occurred while rendering the page. Check developer tools console for details.</p>
  13. <div class="logo">
  14. <a href="https://nuxtjs.org" target="_blank" rel="noopener">Nuxt</a>
  15. </div>
  16. </div>
  17. </div>
  18. </template>
  19. <script>
  20. export default {
  21. name: 'NuxtError',
  22. props: {
  23. error: {
  24. type: Object,
  25. default: null
  26. }
  27. },
  28. computed: {
  29. statusCode () {
  30. return (this.error && this.error.statusCode) || 500
  31. },
  32. message () {
  33. return this.error.message || 'Error'
  34. }
  35. },
  36. head () {
  37. return {
  38. title: this.message,
  39. meta: [
  40. {
  41. name: 'viewport',
  42. content: 'width=device-width,initial-scale=1.0,minimum-scale=1.0'
  43. }
  44. ]
  45. }
  46. }
  47. }
  48. </script>
  49. <style>
  50. .__nuxt-error-page {
  51. padding: 1rem;
  52. background: #F7F8FB;
  53. color: #47494E;
  54. text-align: center;
  55. display: flex;
  56. justify-content: center;
  57. align-items: center;
  58. flex-direction: column;
  59. font-family: sans-serif;
  60. font-weight: 100 !important;
  61. -ms-text-size-adjust: 100%;
  62. -webkit-text-size-adjust: 100%;
  63. -webkit-font-smoothing: antialiased;
  64. position: absolute;
  65. top: 0;
  66. left: 0;
  67. right: 0;
  68. bottom: 0;
  69. }
  70. .__nuxt-error-page .error {
  71. max-width: 450px;
  72. }
  73. .__nuxt-error-page .title {
  74. font-size: 1.5rem;
  75. margin-top: 15px;
  76. color: #47494E;
  77. margin-bottom: 8px;
  78. }
  79. .__nuxt-error-page .description {
  80. color: #7F828B;
  81. line-height: 21px;
  82. margin-bottom: 10px;
  83. }
  84. .__nuxt-error-page a {
  85. color: #7F828B !important;
  86. text-decoration: none;
  87. }
  88. .__nuxt-error-page .logo {
  89. position: fixed;
  90. left: 12px;
  91. bottom: 12px;
  92. }
  93. </style>