error.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <template>
  2. <div class="error-page flex-center flex-col min-h-100vh bg-#F6F8FD">
  3. <div class="error-content text-center">
  4. <div class="text-120px font-bold text-#0F67F8 mb-24px">{{ error?.statusCode }}</div>
  5. <h1 class="text-24px text-#091221 mb-16px font-bold">
  6. {{ error?.statusCode === 404 ? '页面未找到' : '系统出错了' }}
  7. </h1>
  8. <p class="text-16px text-#64748b mb-40px">
  9. {{
  10. error?.statusCode === 404
  11. ? '抱歉,您访问的页面不存在或已被移除'
  12. : '抱歉,服务器暂时无法处理您的请求,请稍后再试'
  13. }}
  14. </p>
  15. <button class="btn-primary" @click="handleError">返回首页</button>
  16. </div>
  17. </div>
  18. </template>
  19. <script setup lang="ts">
  20. import type { NuxtError } from '#app'
  21. const props = defineProps({
  22. error: Object as () => NuxtError,
  23. })
  24. const handleError = () => {
  25. clearError({ redirect: '/' })
  26. }
  27. </script>
  28. <style scoped lang="scss">
  29. .btn-primary {
  30. @apply px-32px py-12px bg-#0F67F8 text-white rounded-8px font-medium transition-all hover:opacity-90 active:scale-95;
  31. box-shadow: 0 4px 12px rgba(15, 103, 248, 0.25);
  32. }
  33. </style>