mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-09-23 12:06:36 +08:00
fix(projects): 添加获取路由组件文件未找到时的错误提示
This commit is contained in:
parent
b35ed8960d
commit
219f87f467
@ -2,6 +2,7 @@ import type { Component } from 'vue';
|
|||||||
import { EnumLayoutComponentName } from '@/enum';
|
import { EnumLayoutComponentName } from '@/enum';
|
||||||
import { BasicLayout, BlankLayout } from '@/layouts';
|
import { BasicLayout, BlankLayout } from '@/layouts';
|
||||||
import { views } from '@/views';
|
import { views } from '@/views';
|
||||||
|
import { consoleError } from '../common';
|
||||||
|
|
||||||
type LayoutComponent = Record<EnumType.LayoutComponentName, () => Promise<Component>>;
|
type LayoutComponent = Record<EnumType.LayoutComponentName, () => Promise<Component>>;
|
||||||
|
|
||||||
@ -22,6 +23,9 @@ export function getLayoutComponent(layoutType: EnumType.LayoutComponentName) {
|
|||||||
* @param routeKey - 路由key
|
* @param routeKey - 路由key
|
||||||
*/
|
*/
|
||||||
export function getViewComponent(routeKey: AuthRoute.RouteKey) {
|
export function getViewComponent(routeKey: AuthRoute.RouteKey) {
|
||||||
|
if (!views[routeKey]) {
|
||||||
|
consoleError(`该路由“${routeKey}”没有对应的组件文件!`);
|
||||||
|
}
|
||||||
return () => setViewComponentName(views[routeKey], routeKey) as Promise<Component>;
|
return () => setViewComponentName(views[routeKey], routeKey) as Promise<Component>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user