constant.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import type { AppRouteRecordRaw } from '/@/router/types';
  2. import ParentLayout from '/@/layouts/page/ParentView.vue';
  3. const EXCEPTION_COMPONENT = () => import('../views/sys/exception/Exception');
  4. /**
  5. * @description: default layout
  6. */
  7. export const LAYOUT = () => import('/@/layouts/default/index.vue');
  8. /**
  9. * @description: page-layout
  10. */
  11. export const getParentLayout = (name: string) => {
  12. return () =>
  13. new Promise((resolve) => {
  14. resolve({
  15. ...ParentLayout,
  16. name,
  17. });
  18. });
  19. };
  20. // 404 on a page
  21. export const PAGE_NOT_FOUND_ROUTE: AppRouteRecordRaw = {
  22. path: '/:path(.*)*',
  23. name: 'ErrorPage',
  24. component: LAYOUT,
  25. meta: {
  26. title: 'ErrorPage',
  27. hideBreadcrumb: true,
  28. },
  29. children: [
  30. {
  31. path: '/:path(.*)*',
  32. name: 'ErrorPage',
  33. component: EXCEPTION_COMPONENT,
  34. meta: {
  35. title: 'ErrorPage',
  36. hideBreadcrumb: true,
  37. },
  38. },
  39. ],
  40. };
  41. export const REDIRECT_NAME = 'Redirect';
  42. export const REDIRECT_ROUTE: AppRouteRecordRaw = {
  43. path: '/redirect',
  44. name: REDIRECT_NAME,
  45. component: LAYOUT,
  46. meta: {
  47. title: REDIRECT_NAME,
  48. hideBreadcrumb: true,
  49. },
  50. children: [
  51. {
  52. path: '/redirect/:path(.*)',
  53. name: REDIRECT_NAME,
  54. component: () => import('/@/views/sys/redirect/index.vue'),
  55. meta: {
  56. title: REDIRECT_NAME,
  57. hideBreadcrumb: true,
  58. },
  59. },
  60. ],
  61. };