diff --git a/src/utils/router/component.ts b/src/utils/router/component.ts index ccb9c8d9..6ffbd4a1 100644 --- a/src/utils/router/component.ts +++ b/src/utils/router/component.ts @@ -2,6 +2,7 @@ import type { Component } from 'vue'; import { EnumLayoutComponentName } from '@/enum'; import { BasicLayout, BlankLayout } from '@/layouts'; import { views } from '@/views'; +import { consoleError } from '../common'; type LayoutComponent = Record Promise>; @@ -22,6 +23,9 @@ export function getLayoutComponent(layoutType: EnumType.LayoutComponentName) { * @param routeKey - 路由key */ export function getViewComponent(routeKey: AuthRoute.RouteKey) { + if (!views[routeKey]) { + consoleError(`该路由“${routeKey}”没有对应的组件文件!`); + } return () => setViewComponentName(views[routeKey], routeKey) as Promise; }