error.vue 673 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <template>
  2. <div>
  3. <h1 v-if="error.statusCode === 404">
  4. {{ pageNotFound }}
  5. </h1>
  6. <h1 v-else>
  7. {{ otherError }}
  8. </h1>
  9. <NuxtLink to="/"> Home page </NuxtLink>
  10. </div>
  11. </template>
  12. <script>
  13. export default {
  14. name: 'EmptyLayout',
  15. layout: 'empty',
  16. props: {
  17. error: {
  18. type: Object,
  19. default: null,
  20. },
  21. },
  22. data() {
  23. return {
  24. pageNotFound: '404 Not Found',
  25. otherError: 'An error occurred',
  26. };
  27. },
  28. head() {
  29. const title =
  30. this.error.statusCode === 404 ? this.pageNotFound : this.otherError;
  31. return {
  32. title,
  33. };
  34. },
  35. };
  36. </script>
  37. <style scoped>
  38. h1 {
  39. font-size: 20px;
  40. }
  41. </style>