nuxt-error.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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"><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" /></svg>
  5. <div class="title">{{ message }}</div>
  6. <p v-if="statusCode === 404" class="description">
  7. <nuxt-link class="error-link" to="/">Back to the home page</nuxt-link>
  8. </p>
  9. <p class="description" v-else>An error occurred while rendering the page. Check developer tools console for details.</p>
  10. <div class="logo">
  11. <a href="https://nuxtjs.org" target="_blank" rel="noopener">Nuxt.js</a>
  12. </div>
  13. </div>
  14. </div>
  15. </template>
  16. <script>
  17. export default {
  18. name: 'nuxt-error',
  19. props: {
  20. error: {
  21. type: Object,
  22. default: null
  23. }
  24. },
  25. head() {
  26. return {
  27. title: this.message,
  28. meta: [
  29. {
  30. name: 'viewport',
  31. content: 'width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no'
  32. }
  33. ]
  34. }
  35. },
  36. computed: {
  37. statusCode() {
  38. return (this.error && this.error.statusCode) || 500
  39. },
  40. message() {
  41. return this.error.message || `Error`
  42. }
  43. }
  44. }
  45. </script>
  46. <style>
  47. .__nuxt-error-page {
  48. padding: 1rem;
  49. background: #F7F8FB;
  50. color: #47494E;
  51. text-align: center;
  52. display: flex;
  53. justify-content: center;
  54. align-items: center;
  55. flex-direction: column;
  56. font-family: sans-serif;
  57. font-weight: 100 !important;
  58. -ms-text-size-adjust: 100%;
  59. -webkit-text-size-adjust: 100%;
  60. -webkit-font-smoothing: antialiased;
  61. position: absolute;
  62. top: 0;
  63. left: 0;
  64. right: 0;
  65. bottom: 0;
  66. }
  67. .__nuxt-error-page .error {
  68. max-width: 450px;
  69. }
  70. .__nuxt-error-page .title {
  71. font-size: 1.5rem;
  72. margin-top: 15px;
  73. color: #47494E;
  74. margin-bottom: 8px;
  75. }
  76. .__nuxt-error-page .description {
  77. color: #7F828B;
  78. line-height: 21px;
  79. margin-bottom: 10px;
  80. }
  81. .__nuxt-error-page a {
  82. color: #7F828B !important;
  83. text-decoration: none;
  84. }
  85. .__nuxt-error-page .logo {
  86. position: fixed;
  87. left: 12px;
  88. bottom: 12px;
  89. }
  90. </style>