From fc4666ef41b51aae44cc865b43826eb9c06d86ce Mon Sep 17 00:00:00 2001 From: vben Date: Thu, 12 Nov 2020 23:15:11 +0800 Subject: [PATCH] chore: route structure adjustment --- src/layouts/default/multitabs/index.tsx | 1 - src/router/routes/modules/dashboard.ts | 6 ++++-- src/router/routes/modules/demo/charts.ts | 6 ++++-- src/router/routes/modules/demo/comp.ts | 6 ++++-- src/router/routes/modules/demo/editor.ts | 6 ++++-- src/router/routes/modules/demo/excel.ts | 6 ++++-- src/router/routes/modules/demo/feat.ts | 6 ++++-- src/router/routes/modules/demo/form.ts | 5 +++-- src/router/routes/modules/demo/iframe.ts | 6 ++++-- src/router/routes/modules/demo/page.ts | 6 ++++-- src/router/routes/modules/demo/permission.ts | 12 ++++++++++-- src/router/routes/modules/demo/table.ts | 6 ++++-- src/router/routes/modules/demo/tree.ts | 6 ++++-- src/router/types.d.ts | 1 + 14 files changed, 54 insertions(+), 25 deletions(-) diff --git a/src/layouts/default/multitabs/index.tsx b/src/layouts/default/multitabs/index.tsx index 5aca4157..f91ae3b4 100644 --- a/src/layouts/default/multitabs/index.tsx +++ b/src/layouts/default/multitabs/index.tsx @@ -43,7 +43,6 @@ export default defineComponent({ } const lastChangeRoute = unref(tabStore.getLastChangeRouteState); - if (!lastChangeRoute || !userStore.getTokenState) return; const { path, fullPath } = lastChangeRoute; diff --git a/src/router/routes/modules/dashboard.ts b/src/router/routes/modules/dashboard.ts index 8d4c92f6..57ab0e64 100644 --- a/src/router/routes/modules/dashboard.ts +++ b/src/router/routes/modules/dashboard.ts @@ -2,7 +2,7 @@ import type { AppRouteModule } from '/@/router/types'; import { PAGE_LAYOUT_COMPONENT } from '/@/router/constant'; -export default { +const dashboard: AppRouteModule = { layout: { path: '/dashboard', name: 'Dashboard', @@ -41,4 +41,6 @@ export default { }, }, ], -} as AppRouteModule; +}; + +export default dashboard; diff --git a/src/router/routes/modules/demo/charts.ts b/src/router/routes/modules/demo/charts.ts index a86da872..df7c7189 100644 --- a/src/router/routes/modules/demo/charts.ts +++ b/src/router/routes/modules/demo/charts.ts @@ -2,7 +2,7 @@ import type { AppRouteModule } from '/@/router/types'; import { PAGE_LAYOUT_COMPONENT } from '/@/router/constant'; -export default { +const charts: AppRouteModule = { layout: { path: '/charts', name: 'Charts', @@ -57,4 +57,6 @@ export default { component: () => import('/@/views/demo/echarts/apex/index.vue'), }, ], -} as AppRouteModule; +}; + +export default charts; diff --git a/src/router/routes/modules/demo/comp.ts b/src/router/routes/modules/demo/comp.ts index f9f013e0..36841d79 100644 --- a/src/router/routes/modules/demo/comp.ts +++ b/src/router/routes/modules/demo/comp.ts @@ -2,7 +2,7 @@ import type { AppRouteModule } from '/@/router/types'; import { PAGE_LAYOUT_COMPONENT } from '/@/router/constant'; -export default { +const comp: AppRouteModule = { layout: { path: '/comp', name: 'Comp', @@ -179,4 +179,6 @@ export default { }, }, ], -} as AppRouteModule; +}; + +export default comp; diff --git a/src/router/routes/modules/demo/editor.ts b/src/router/routes/modules/demo/editor.ts index 639cb250..c3d176c1 100644 --- a/src/router/routes/modules/demo/editor.ts +++ b/src/router/routes/modules/demo/editor.ts @@ -2,7 +2,7 @@ import type { AppRouteModule } from '/@/router/types'; import { PAGE_LAYOUT_COMPONENT } from '/@/router/constant'; -export default { +const editor: AppRouteModule = { layout: { path: '/editor', name: 'Editor', @@ -51,4 +51,6 @@ export default { ], }, ], -} as AppRouteModule; +}; + +export default editor; diff --git a/src/router/routes/modules/demo/excel.ts b/src/router/routes/modules/demo/excel.ts index 24fa5a5c..177c19da 100644 --- a/src/router/routes/modules/demo/excel.ts +++ b/src/router/routes/modules/demo/excel.ts @@ -2,7 +2,7 @@ import type { AppRouteModule } from '/@/router/types'; import { PAGE_LAYOUT_COMPONENT } from '/@/router/constant'; -export default { +const excel: AppRouteModule = { layout: { path: '/excel', name: 'Excel', @@ -48,4 +48,6 @@ export default { }, }, ], -} as AppRouteModule; +}; + +export default excel; diff --git a/src/router/routes/modules/demo/feat.ts b/src/router/routes/modules/demo/feat.ts index 6788379f..ba5c834c 100644 --- a/src/router/routes/modules/demo/feat.ts +++ b/src/router/routes/modules/demo/feat.ts @@ -2,7 +2,7 @@ import type { AppRouteModule } from '/@/router/types'; import { PAGE_LAYOUT_COMPONENT } from '/@/router/constant'; -export default { +const feat: AppRouteModule = { layout: { path: '/feat', name: 'FeatDemo', @@ -114,4 +114,6 @@ export default { }, }, ], -} as AppRouteModule; +}; + +export default feat; diff --git a/src/router/routes/modules/demo/form.ts b/src/router/routes/modules/demo/form.ts index a473436b..dec9d0a3 100644 --- a/src/router/routes/modules/demo/form.ts +++ b/src/router/routes/modules/demo/form.ts @@ -2,7 +2,7 @@ import type { AppRouteModule } from '/@/router/types'; import { PAGE_LAYOUT_COMPONENT } from '/@/router/constant'; -export default { +const form: AppRouteModule = { layout: { path: '/form', name: 'FormDemo', @@ -72,4 +72,5 @@ export default { }, }, ], -} as AppRouteModule; +}; +export default form; diff --git a/src/router/routes/modules/demo/iframe.ts b/src/router/routes/modules/demo/iframe.ts index f2a07246..38119f00 100644 --- a/src/router/routes/modules/demo/iframe.ts +++ b/src/router/routes/modules/demo/iframe.ts @@ -3,7 +3,7 @@ import type { AppRouteModule } from '/@/router/types'; import { PAGE_LAYOUT_COMPONENT } from '/@/router/constant'; const IFrame = () => import('/@/views/sys/iframe/FrameBlank.vue'); -export default { +const iframe: AppRouteModule = { layout: { path: '/frame', name: 'Frame', @@ -46,4 +46,6 @@ export default { }, }, ], -} as AppRouteModule; +}; + +export default iframe; diff --git a/src/router/routes/modules/demo/page.ts b/src/router/routes/modules/demo/page.ts index 3ba2a980..10766c66 100644 --- a/src/router/routes/modules/demo/page.ts +++ b/src/router/routes/modules/demo/page.ts @@ -5,7 +5,7 @@ import { ExceptionEnum } from '/@/enums/exceptionEnum'; const ExceptionPage = () => import('/@/views/sys/exception/Exception'); -export default { +const page: AppRouteModule = { path: '/page-demo', name: 'PageDemo', component: PAGE_LAYOUT_COMPONENT, @@ -117,4 +117,6 @@ export default { }, // =============================exception end============================= ], -} as AppRouteModule; +}; + +export default page; diff --git a/src/router/routes/modules/demo/permission.ts b/src/router/routes/modules/demo/permission.ts index a4ecc70e..8fc73a9b 100644 --- a/src/router/routes/modules/demo/permission.ts +++ b/src/router/routes/modules/demo/permission.ts @@ -3,7 +3,7 @@ import type { AppRouteModule } from '/@/router/types'; import { PAGE_LAYOUT_COMPONENT } from '/@/router/constant'; import { RoleEnum } from '/@/enums/roleEnum'; -export default { +const permission: AppRouteModule = { layout: { path: '/permission', name: 'Permission', @@ -25,6 +25,7 @@ export default { children: [ { path: 'page', + name: 'FrontPageAuth', component: () => import('/@/views/demo/permission/front/index.vue'), meta: { title: '页面权限', @@ -32,6 +33,7 @@ export default { }, { path: 'btn', + name: 'FrontBtnAuth', component: () => import('/@/views/demo/permission/front/Btn.vue'), meta: { title: '按钮权限', @@ -39,6 +41,7 @@ export default { }, { path: 'auth-pageA', + name: 'FrontAuthPageA', component: () => import('/@/views/demo/permission/front/AuthPageA.vue'), meta: { title: '权限测试页A', @@ -47,6 +50,7 @@ export default { }, { path: 'auth-pageB', + name: 'FrontAuthPageB', component: () => import('/@/views/demo/permission/front/AuthPageB.vue'), meta: { title: '权限测试页B', @@ -64,6 +68,7 @@ export default { children: [ { path: 'page', + name: 'BackAuthPage', component: () => import('/@/views/demo/permission/back/index.vue'), meta: { title: '页面权限', @@ -71,6 +76,7 @@ export default { }, { path: 'btn', + name: 'BackAuthBtn', component: () => import('/@/views/demo/permission/back/Btn.vue'), meta: { title: '按钮权限', @@ -79,4 +85,6 @@ export default { ], }, ], -} as AppRouteModule; +}; + +export default permission; diff --git a/src/router/routes/modules/demo/table.ts b/src/router/routes/modules/demo/table.ts index d0d0cc4a..94c3bc7a 100644 --- a/src/router/routes/modules/demo/table.ts +++ b/src/router/routes/modules/demo/table.ts @@ -2,7 +2,7 @@ import type { AppRouteModule } from '/@/router/types'; import { PAGE_LAYOUT_COMPONENT } from '/@/router/constant'; -export default { +const table: AppRouteModule = { layout: { path: '/table', name: 'TableDemo', @@ -128,4 +128,6 @@ export default { }, }, ], -} as AppRouteModule; +}; + +export default table; diff --git a/src/router/routes/modules/demo/tree.ts b/src/router/routes/modules/demo/tree.ts index 75d060a7..1701b0f8 100644 --- a/src/router/routes/modules/demo/tree.ts +++ b/src/router/routes/modules/demo/tree.ts @@ -2,7 +2,7 @@ import type { AppRouteModule } from '/@/router/types'; import { PAGE_LAYOUT_COMPONENT } from '/@/router/constant'; -export default { +const tree: AppRouteModule = { layout: { path: '/tree', name: 'TreeDemo', @@ -39,4 +39,6 @@ export default { }, }, ], -} as AppRouteModule; +}; + +export default tree; diff --git a/src/router/types.d.ts b/src/router/types.d.ts index 12f30944..3c7025a4 100644 --- a/src/router/types.d.ts +++ b/src/router/types.d.ts @@ -36,6 +36,7 @@ export interface RouteMeta { } export interface AppRouteRecordRaw extends Omit { + name: string; meta: RouteMeta; component?: any; components?: any;