refactor(projects): 优化路由导入页面写法,页面路由调整

This commit is contained in:
Soybean
2021-11-28 12:19:00 +08:00
parent d683894beb
commit 0b10b5056e
36 changed files with 303 additions and 197 deletions

View File

@ -1,12 +1,12 @@
import type { RouteRecordRaw } from 'vue-router';
import { setSingleRoute } from '@/utils';
import { BasicLayout } from '@/layouts';
import About from '@/views/about/index.vue';
import { About } from '@/views';
import { getRouteConst, routeName } from '../constant';
const { name, path, title } = getRouteConst('about');
const ABOUT: RouteRecordRaw = setSingleRoute({
const about: RouteRecordRaw = setSingleRoute({
route: {
name,
path,
@ -26,4 +26,4 @@ const ABOUT: RouteRecordRaw = setSingleRoute({
notFoundName: routeName('not-found')
});
export default ABOUT;
export default about;

View File

@ -1,84 +1,40 @@
import type { RouteRecordRaw } from 'vue-router';
import { BasicLayout } from '@/layouts';
import ComponentMap from '@/views/component/map/index.vue';
import ComponentVideo from '@/views/component/video/index.vue';
import EditorQuill from '@/views/component/editor/quill/index.vue';
import EditorMarkdown from '@/views/component/editor/markdown/index.vue';
import ComponentSwiper from '@/views/component/swiper/index.vue';
import { ComponentButton, ComponentCard } from '@/views';
import { routeName, routePath, routeTitle } from '../constant';
const COMPONENT: RouteRecordRaw = {
const component: RouteRecordRaw = {
name: routeName('component'),
path: routePath('component'),
component: BasicLayout,
redirect: { name: routeName('component_map') },
redirect: { name: routeName('component_button') },
meta: {
requiresAuth: true,
title: routeTitle('component'),
icon: 'fluent:app-store-24-regular',
order: 3
order: 4
},
children: [
{
name: routeName('component_map'),
path: routePath('component_map'),
component: ComponentMap,
name: routeName('component_button'),
path: routePath('component_button'),
component: ComponentButton,
meta: {
title: routeTitle('component_button'),
requiresAuth: true,
title: routeTitle('component_map'),
fullPage: true
keepAlive: true
}
},
{
name: routeName('component_video'),
path: routePath('component_video'),
component: ComponentVideo,
name: routeName('component_card'),
path: routePath('component_card'),
component: ComponentCard,
meta: {
title: routeTitle('component_card'),
requiresAuth: true,
title: routeTitle('component_video'),
fullPage: true
}
},
{
name: routeName('component_editor'),
path: routePath('component_editor'),
redirect: { name: routeName('component_editor_quill') },
meta: {
title: routeTitle('component_editor')
},
children: [
{
name: routeName('component_editor_quill'),
path: routePath('component_editor_quill'),
component: EditorQuill,
meta: {
requiresAuth: true,
title: routeTitle('component_editor_quill'),
fullPage: true
}
},
{
name: routeName('component_editor_markdown'),
path: routePath('component_editor_markdown'),
component: EditorMarkdown,
meta: {
requiresAuth: true,
title: routeTitle('component_editor_markdown'),
fullPage: true
}
}
]
},
{
name: routeName('component_swiper'),
path: routePath('component_swiper'),
component: ComponentSwiper,
meta: {
requiresAuth: true,
title: routeTitle('component_swiper')
keepAlive: true
}
}
]
};
export default COMPONENT;
export default component;

View File

@ -1,10 +1,9 @@
import type { RouteRecordRaw } from 'vue-router';
import { BasicLayout } from '@/layouts';
import DashboardAnalysis from '@/views/dashboard/analysis/index.vue';
import DashboardWorkbench from '@/views/dashboard/workbench/index.vue';
import { DashboardAnalysis, DashboardWorkbench } from '@/views';
import { routeName, routePath, routeTitle } from '../constant';
const DASHBOARD: RouteRecordRaw = {
const dashboard: RouteRecordRaw = {
name: routeName('dashboard'),
path: routePath('dashboard'),
component: BasicLayout,
@ -38,4 +37,4 @@ const DASHBOARD: RouteRecordRaw = {
]
};
export default DASHBOARD;
export default dashboard;

View File

@ -1,11 +1,9 @@
import type { RouteRecordRaw } from 'vue-router';
import { BasicLayout } from '@/layouts';
import DocumentVue from '@/views/document/vue/index.vue';
import DocumentVite from '@/views/document/vite/index.vue';
import DocumentNaive from '@/views/document/naive/index.vue';
import { DocumentVue, DocumentVite, DocumentNaive } from '@/views';
import { routeName, routePath, routeTitle } from '../constant';
const DOCUMENT: RouteRecordRaw = {
const document: RouteRecordRaw = {
name: routeName('document'),
path: routePath('document'),
component: BasicLayout,
@ -51,4 +49,4 @@ const DOCUMENT: RouteRecordRaw = {
]
};
export default DOCUMENT;
export default document;

View File

@ -1,11 +1,9 @@
import type { RouteRecordRaw } from 'vue-router';
import { BasicLayout } from '@/layouts';
import Exception403 from '@/views/system/exception/403.vue';
import Exception404 from '@/views/system/exception/404.vue';
import Exception500 from '@/views/system/exception/500.vue';
import { NoPermission, NotFound, ServiceError } from '@/views';
import { routeName, routePath, routeTitle } from '../constant';
const EXCEPTION: RouteRecordRaw = {
const exception: RouteRecordRaw = {
name: routeName('exception'),
path: routePath('exception'),
component: BasicLayout,
@ -20,7 +18,7 @@ const EXCEPTION: RouteRecordRaw = {
{
name: routeName('exception_403'),
path: routePath('exception_403'),
component: Exception403,
component: NoPermission,
meta: {
requiresAuth: true,
title: routeTitle('exception_403'),
@ -30,7 +28,7 @@ const EXCEPTION: RouteRecordRaw = {
{
name: routeName('exception_404'),
path: routePath('exception_404'),
component: Exception404,
component: NotFound,
meta: {
requiresAuth: true,
title: routeTitle('exception_404'),
@ -40,7 +38,7 @@ const EXCEPTION: RouteRecordRaw = {
{
name: routeName('exception_500'),
path: routePath('exception_500'),
component: Exception500,
component: ServiceError,
meta: {
requiresAuth: true,
title: routeTitle('exception_500'),
@ -50,4 +48,4 @@ const EXCEPTION: RouteRecordRaw = {
]
};
export default EXCEPTION;
export default exception;

View File

@ -1,51 +0,0 @@
import type { RouteRecordRaw } from 'vue-router';
import { BasicLayout } from '@/layouts';
import FeatCopy from '@/views/feat/copy/index.vue';
import FeatIcon from '@/views/feat/icon/index.vue';
import FeatPrint from '@/views/feat/print/index.vue';
import { routeName, routePath, routeTitle } from '../constant';
const FEAT: RouteRecordRaw = {
name: routeName('feat'),
path: routePath('feat'),
component: BasicLayout,
redirect: { name: routeName('feat_copy') },
meta: {
requiresAuth: true,
title: routeTitle('feat'),
icon: 'ic:round-repeat',
order: 4
},
children: [
{
name: routeName('feat_copy'),
path: routePath('feat_copy'),
component: FeatCopy,
meta: {
requiresAuth: true,
title: routeTitle('feat_copy'),
fullPage: true
}
},
{
name: routeName('feat_icon'),
path: routePath('feat_icon'),
component: FeatIcon,
meta: {
requiresAuth: true,
title: routeTitle('feat_icon')
}
},
{
name: routeName('feat_print'),
path: routePath('feat_print'),
component: FeatPrint,
meta: {
requiresAuth: true,
title: routeTitle('feat_print')
}
}
]
};
export default FEAT;

View File

@ -3,7 +3,7 @@ import { BasicLayout } from '@/layouts';
import MultiMenuFirstSecond from '@/views/multi-menu/first/second/index.vue';
import { routeName, routePath, routeTitle } from '../constant';
const MULTI_MENU: RouteRecordRaw = {
const multiMenu: RouteRecordRaw = {
name: routeName('multi-menu'),
path: routePath('multi-menu'),
component: BasicLayout,
@ -38,4 +38,4 @@ const MULTI_MENU: RouteRecordRaw = {
]
};
export default MULTI_MENU;
export default multiMenu;

View File

@ -0,0 +1,118 @@
import type { RouteRecordRaw } from 'vue-router';
import { BasicLayout } from '@/layouts';
import {
PluginMap,
PluginVideo,
PluginEditorQuill,
PluginEditorMarkdown,
PluginSwiper,
PluginCopy,
PluginIcon,
PluginPrint
} from '@/views';
import { routeName, routePath, routeTitle } from '../constant';
const plugin: RouteRecordRaw = {
name: routeName('plugin'),
path: routePath('plugin'),
component: BasicLayout,
redirect: { name: routeName('plugin_map') },
meta: {
requiresAuth: true,
title: routeTitle('plugin'),
icon: 'clarity:plugin-line',
order: 3
},
children: [
{
name: routeName('plugin_map'),
path: routePath('plugin_map'),
component: PluginMap,
meta: {
requiresAuth: true,
title: routeTitle('plugin_map'),
fullPage: true
}
},
{
name: routeName('plugin_video'),
path: routePath('plugin_video'),
component: PluginVideo,
meta: {
requiresAuth: true,
title: routeTitle('plugin_video'),
fullPage: true
}
},
{
name: routeName('plugin_editor'),
path: routePath('plugin_editor'),
redirect: { name: routeName('plugin_editor_quill') },
meta: {
title: routeTitle('plugin_editor')
},
children: [
{
name: routeName('plugin_editor_quill'),
path: routePath('plugin_editor_quill'),
component: PluginEditorQuill,
meta: {
requiresAuth: true,
title: routeTitle('plugin_editor_quill'),
fullPage: true
}
},
{
name: routeName('plugin_editor_markdown'),
path: routePath('plugin_editor_markdown'),
component: PluginEditorMarkdown,
meta: {
requiresAuth: true,
title: routeTitle('plugin_editor_markdown'),
fullPage: true
}
}
]
},
{
name: routeName('plugin_swiper'),
path: routePath('plugin_swiper'),
component: PluginSwiper,
meta: {
requiresAuth: true,
title: routeTitle('plugin_swiper')
}
},
{
name: routeName('plugin_copy'),
path: routePath('plugin_copy'),
component: PluginCopy,
meta: {
requiresAuth: true,
title: routeTitle('plugin_copy'),
fullPage: true
}
},
{
name: routeName('plugin_icon'),
path: routePath('plugin_icon'),
component: PluginIcon,
meta: {
requiresAuth: true,
title: routeTitle('plugin_icon')
}
},
{
name: routeName('plugin_print'),
path: routePath('plugin_print'),
component: PluginPrint,
meta: {
requiresAuth: true,
title: routeTitle('plugin_print')
}
}
]
};
export default plugin;

View File

@ -1,12 +1,12 @@
import type { RouteRecordRaw } from 'vue-router';
import { setSingleRoute } from '@/utils';
import { BlankLayout } from '@/layouts';
import Website from '@/views/website/index.vue';
import { Website } from '@/views';
import { getRouteConst, routeName } from '../constant';
const { name, path, title } = getRouteConst('website');
const WEBSITE: RouteRecordRaw = setSingleRoute({
const website: RouteRecordRaw = setSingleRoute({
route: {
name,
path,
@ -25,4 +25,4 @@ const WEBSITE: RouteRecordRaw = setSingleRoute({
notFoundName: routeName('not-found')
});
export default WEBSITE;
export default website;