nuxt-error.vue 2.1 KB

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