vue-vben-admin/src/router/constant.ts

57 lines
1.2 KiB
TypeScript
Raw Normal View History

2020-09-28 20:19:10 +08:00
import type { AppRouteRecordRaw } from '/@/router/types';
2020-12-04 21:25:33 +08:00
import ParentLayout from '/@/layouts/page/ParentView.vue';
2020-09-28 20:19:10 +08:00
const EXCEPTION_COMPONENT = () => import('../views/sys/exception/Exception');
/**
* @description: default layout
*/
2020-12-03 21:49:32 +08:00
export const LAYOUT = () => import('/@/layouts/default/index');
2020-09-28 20:19:10 +08:00
2020-12-03 21:49:32 +08:00
/**
* @description: page-layout
*/
export const getParentLayout = (name: string) => {
return () =>
new Promise((resolve) => {
resolve({
...ParentLayout,
name,
});
});
};
2020-09-28 20:19:10 +08:00
// 404 on a page
export const PAGE_NOT_FOUND_ROUTE: AppRouteRecordRaw = {
path: '/:path(.*)*',
name: 'ErrorPage',
component: EXCEPTION_COMPONENT,
meta: {
title: 'ErrorPage',
hideBreadcrumb: true,
},
};
2020-10-30 21:32:05 +08:00
2020-12-03 21:49:32 +08:00
export const REDIRECT_NAME = 'Redirect';
2020-09-28 20:19:10 +08:00
export const REDIRECT_ROUTE: AppRouteRecordRaw = {
2020-12-03 21:49:32 +08:00
path: '/redirect',
name: REDIRECT_NAME,
component: LAYOUT,
2020-09-28 20:19:10 +08:00
meta: {
2020-12-03 21:49:32 +08:00
title: REDIRECT_NAME,
2020-09-28 20:19:10 +08:00
hideBreadcrumb: true,
},
2020-12-03 21:49:32 +08:00
children: [
{
path: '/redirect/:path(.*)',
name: REDIRECT_NAME,
component: () => import('/@/views/sys/redirect/index.vue'),
meta: {
title: REDIRECT_NAME,
hideBreadcrumb: true,
},
},
],
2020-09-28 20:19:10 +08:00
};