Blame view

src/router/constant.ts 1.84 KB
陈文彬 authored
1
import type { AppRouteRecordRaw } from '/@/router/types';
vben authored
2
import ParentLayout from '/@/layouts/page/ParentView.vue';
3
import { t } from '/@/hooks/web/useI18n';
陈文彬 authored
4
vben authored
5
6
7
export const REDIRECT_NAME = 'Redirect';

export const EXCEPTION_COMPONENT = () => import('../views/sys/exception/Exception.vue');
陈文彬 authored
8
9
10
11

/**
 * @description: default layout
 */
vben authored
12
export const LAYOUT = () => import('/@/layouts/default/index.vue');
陈文彬 authored
13
14
15
16

/**
 * @description: page-layout
 */
vben authored
17
18
19
20
21
22
23
24
25
export const getParentLayout = (name: string) => {
  return () =>
    new Promise((resolve) => {
      resolve({
        ...ParentLayout,
        name,
      });
    });
};
陈文彬 authored
26
27
28
29
30

// 404 on a page
export const PAGE_NOT_FOUND_ROUTE: AppRouteRecordRaw = {
  path: '/:path(.*)*',
  name: 'ErrorPage',
31
  component: LAYOUT,
陈文彬 authored
32
33
34
35
  meta: {
    title: 'ErrorPage',
    hideBreadcrumb: true,
  },
36
37
  children: [
    {
vben authored
38
      path: '/:path(.*)*',
39
40
41
42
43
44
45
46
      name: 'ErrorPage',
      component: EXCEPTION_COMPONENT,
      meta: {
        title: 'ErrorPage',
        hideBreadcrumb: true,
      },
    },
  ],
陈文彬 authored
47
};
vben authored
48
陈文彬 authored
49
export const REDIRECT_ROUTE: AppRouteRecordRaw = {
vben authored
50
51
52
  path: '/redirect',
  name: REDIRECT_NAME,
  component: LAYOUT,
陈文彬 authored
53
  meta: {
vben authored
54
    title: REDIRECT_NAME,
陈文彬 authored
55
56
    hideBreadcrumb: true,
  },
vben authored
57
58
59
60
61
62
63
64
65
66
67
  children: [
    {
      path: '/redirect/:path(.*)',
      name: REDIRECT_NAME,
      component: () => import('/@/views/sys/redirect/index.vue'),
      meta: {
        title: REDIRECT_NAME,
        hideBreadcrumb: true,
      },
    },
  ],
陈文彬 authored
68
};
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

export const ERROR_LOG_ROUTE: AppRouteRecordRaw = {
  path: '/error-log',
  name: 'errorLog',
  component: LAYOUT,
  meta: {
    title: 'ErrorLog',
    hideBreadcrumb: true,
  },
  children: [
    {
      path: 'list',
      name: 'errorLogList',
      component: () => import('/@/views/sys/error-log/index.vue'),
      meta: {
        title: t('routes.basic.errorLogList'),
        hideBreadcrumb: true,
      },
    },
  ],
};