chore: init project
This commit is contained in:
78
apps/antd-view/src/router/routes/builtin.ts
Normal file
78
apps/antd-view/src/router/routes/builtin.ts
Normal file
@@ -0,0 +1,78 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
import { Fallback } from '@vben/common-ui';
|
||||
|
||||
import { AuthPageLayout } from './layout';
|
||||
|
||||
/** 静态路由列表,访问这些页面可以不需要权限 */
|
||||
const builtinRoutes: RouteRecordRaw[] = [
|
||||
{
|
||||
component: AuthPageLayout,
|
||||
meta: {
|
||||
title: 'Authentication',
|
||||
},
|
||||
name: 'Authentication',
|
||||
path: '/auth',
|
||||
children: [
|
||||
{
|
||||
name: 'Login',
|
||||
path: 'login',
|
||||
component: () => import('@/views/authentication/login.vue'),
|
||||
meta: {
|
||||
ignoreAccess: true,
|
||||
title: 'Login',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'CodeLogin',
|
||||
path: 'code-login',
|
||||
component: () => import('@/views/authentication/code-login.vue'),
|
||||
meta: {
|
||||
ignoreAccess: true,
|
||||
title: 'CodeLogin',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'QrCodeLogin',
|
||||
path: 'qrcode-login',
|
||||
component: () => import('@/views/authentication/qrcode-login.vue'),
|
||||
meta: {
|
||||
ignoreAccess: true,
|
||||
title: 'QrCodeLogin',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'ForgetPassword',
|
||||
path: 'forget-password',
|
||||
component: () => import('@/views/authentication/forget-password.vue'),
|
||||
meta: {
|
||||
ignoreAccess: true,
|
||||
title: 'ForgetPassword',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Register',
|
||||
path: 'register',
|
||||
component: () => import('@/views/authentication/register.vue'),
|
||||
meta: {
|
||||
ignoreAccess: true,
|
||||
title: 'Register',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
// 错误页
|
||||
{
|
||||
component: Fallback,
|
||||
meta: {
|
||||
hideInBreadcrumb: true,
|
||||
hideInMenu: true,
|
||||
hideInTab: true,
|
||||
title: 'Fallback',
|
||||
},
|
||||
name: 'Fallback',
|
||||
path: '/:path(.*)*',
|
||||
},
|
||||
];
|
||||
|
||||
export { builtinRoutes };
|
66
apps/antd-view/src/router/routes/index.ts
Normal file
66
apps/antd-view/src/router/routes/index.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
import { builtinRoutes } from './builtin';
|
||||
import { Layout } from './layout';
|
||||
import { nestedRoutes } from './modules/nested';
|
||||
import { outsideRoutes } from './modules/outside';
|
||||
|
||||
/** 动态路由 */
|
||||
const dynamicRoutes: RouteRecordRaw[] = [
|
||||
// 根路由
|
||||
{
|
||||
component: Layout,
|
||||
meta: {
|
||||
hideChildrenInMenu: true,
|
||||
title: '首页',
|
||||
},
|
||||
name: 'Home',
|
||||
path: '/',
|
||||
redirect: '/welcome',
|
||||
children: [
|
||||
{
|
||||
name: 'Welcome',
|
||||
path: '/welcome',
|
||||
component: () => import('@/views/dashboard/index.vue'),
|
||||
meta: {
|
||||
affixTab: true,
|
||||
title: 'Welcome',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
...nestedRoutes,
|
||||
...outsideRoutes,
|
||||
// 关于
|
||||
{
|
||||
component: Layout,
|
||||
meta: {
|
||||
hideChildrenInMenu: true,
|
||||
icon: 'https://cdn.jsdelivr.net/gh/vbenjs/vben-cdn-static@0.1.2/vben-admin/admin-logo.png',
|
||||
keepAlive: false,
|
||||
title: '关于',
|
||||
},
|
||||
name: 'AboutLayout',
|
||||
path: '/about',
|
||||
redirect: '/about/index',
|
||||
children: [
|
||||
{
|
||||
name: 'About',
|
||||
path: 'index',
|
||||
component: () => import('@/views/about/index.vue'),
|
||||
meta: {
|
||||
keepAlive: false,
|
||||
title: '关于',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
/** 排除在主框架外的路由,这些路由没有菜单和顶部及其他框架内容 */
|
||||
const externalRoutes: RouteRecordRaw[] = [];
|
||||
|
||||
/** 静态路由列表,访问这些页面可以不需要权限 */
|
||||
const staticRoutes: RouteRecordRaw[] = [...builtinRoutes];
|
||||
|
||||
export { dynamicRoutes, externalRoutes, staticRoutes };
|
8
apps/antd-view/src/router/routes/layout.ts
Normal file
8
apps/antd-view/src/router/routes/layout.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
const Layout = () => import('@/layout.vue');
|
||||
|
||||
const IFrameView = () => import('@vben/layouts').then((m) => m.IFrameView);
|
||||
|
||||
const AuthPageLayout = () =>
|
||||
import('@vben/layouts').then((m) => m.AuthPageLayout);
|
||||
|
||||
export { AuthPageLayout, IFrameView, Layout };
|
71
apps/antd-view/src/router/routes/modules/nested.ts
Normal file
71
apps/antd-view/src/router/routes/modules/nested.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
import { Layout } from '../layout';
|
||||
|
||||
export const nestedRoutes: RouteRecordRaw[] = [
|
||||
{
|
||||
component: Layout,
|
||||
meta: {
|
||||
keepAlive: true,
|
||||
title: '多级菜单',
|
||||
},
|
||||
name: 'Nested',
|
||||
path: '/nested',
|
||||
children: [
|
||||
{
|
||||
name: 'Menu1',
|
||||
path: 'menu1',
|
||||
component: () => import('@/views/nested/menu-1.vue'),
|
||||
meta: {
|
||||
keepAlive: true,
|
||||
title: '菜单1',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Menu2',
|
||||
path: 'menu2',
|
||||
component: () => import('@/views/nested/menu-2.vue'),
|
||||
meta: {
|
||||
keepAlive: true,
|
||||
title: '菜单2',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Menu3',
|
||||
path: 'menu3',
|
||||
meta: {
|
||||
title: '菜单3',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
name: 'Menu31',
|
||||
path: 'menu3-1',
|
||||
component: () => import('@/views/nested/menu-3-1.vue'),
|
||||
meta: {
|
||||
keepAlive: true,
|
||||
title: '菜单3-1',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Menu32',
|
||||
path: 'menu3-2',
|
||||
meta: {
|
||||
title: '菜单3-2',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
name: 'Menu321',
|
||||
path: 'menu3-2-1',
|
||||
component: () => import('@/views/nested/menu-3-2-1.vue'),
|
||||
meta: {
|
||||
keepAlive: true,
|
||||
title: '菜单3-2-1',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
37
apps/antd-view/src/router/routes/modules/outside.ts
Normal file
37
apps/antd-view/src/router/routes/modules/outside.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
|
||||
import { IFrameView, Layout } from '../layout';
|
||||
|
||||
export const outsideRoutes: RouteRecordRaw[] = [
|
||||
{
|
||||
component: Layout,
|
||||
meta: {
|
||||
title: '外部页面',
|
||||
},
|
||||
name: 'Outside',
|
||||
path: '/outside',
|
||||
redirect: '/outside/document',
|
||||
children: [
|
||||
{
|
||||
name: 'Document',
|
||||
path: 'document',
|
||||
component: IFrameView,
|
||||
meta: {
|
||||
iframeSrc: 'https://doc.vvbin.cn/',
|
||||
// keepAlive: true,
|
||||
title: '项目文档',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'IFrameView',
|
||||
path: 'vue-document',
|
||||
component: IFrameView,
|
||||
meta: {
|
||||
iframeSrc: 'https://cn.vuejs.org/',
|
||||
keepAlive: true,
|
||||
title: 'Vue 文档(缓存)',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
Reference in New Issue
Block a user