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