From 219f87f46758f328f26697f66d8583f49c0d41de Mon Sep 17 00:00:00 2001 From: Soybean <2570172956@qq.com> Date: Thu, 21 Apr 2022 09:04:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(projects):=20=E6=B7=BB=E5=8A=A0=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E8=B7=AF=E7=94=B1=E7=BB=84=E4=BB=B6=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=9C=AA=E6=89=BE=E5=88=B0=E6=97=B6=E7=9A=84=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/router/component.ts | 4 ++++ 1 file changed, 4 insertions(+) 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; }