constant.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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');
  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. redirect: '/error/404',
  25. component: LAYOUT,
  26. meta: {
  27. title: 'ErrorPage',
  28. hideBreadcrumb: true,
  29. },
  30. children: [
  31. {
  32. path: '/error/404',
  33. name: 'ErrorPage',
  34. component: EXCEPTION_COMPONENT,
  35. meta: {
  36. title: 'ErrorPage',
  37. hideBreadcrumb: true,
  38. },
  39. },
  40. ],
  41. };
  42. export const REDIRECT_NAME = 'Redirect';
  43. export const REDIRECT_ROUTE: AppRouteRecordRaw = {
  44. path: '/redirect',
  45. name: REDIRECT_NAME,
  46. component: LAYOUT,
  47. meta: {
  48. title: REDIRECT_NAME,
  49. hideBreadcrumb: true,
  50. },
  51. children: [
  52. {
  53. path: '/redirect/:path(.*)',
  54. name: REDIRECT_NAME,
  55. component: () => import('/@/views/sys/redirect/index.vue'),
  56. meta: {
  57. title: REDIRECT_NAME,
  58. hideBreadcrumb: true,
  59. },
  60. },
  61. ],
  62. };