mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-02-03 02:54:40 +08:00
fix(route): 获取 LAYOUT 或 IFRAME 忽略大小写。 并且在通过component找不到页面时打印警告,并返回404页面
This commit is contained in:
parent
7028e0031d
commit
452b2599f4
@ -1,7 +1,7 @@
|
||||
import type { AppRouteModule, AppRouteRecordRaw } from '/@/router/types';
|
||||
import type { Router, RouteRecordNormalized } from 'vue-router';
|
||||
|
||||
import { getParentLayout, LAYOUT } from '/@/router/constant';
|
||||
import { getParentLayout, LAYOUT, EXCEPTION_COMPONENT } from '/@/router/constant';
|
||||
import { cloneDeep, omit } from 'lodash-es';
|
||||
import { warn } from '/@/utils/log';
|
||||
import { createRouter, createWebHashHistory } from 'vue-router';
|
||||
@ -27,7 +27,7 @@ function asyncImportRoute(routes: AppRouteRecordRaw[] | undefined) {
|
||||
const { component, name } = item;
|
||||
const { children } = item;
|
||||
if (component) {
|
||||
const layoutFound = LayoutMap.get(component as string);
|
||||
const layoutFound = LayoutMap.get(component.toUpperCase());
|
||||
if (layoutFound) {
|
||||
item.component = layoutFound;
|
||||
} else {
|
||||
@ -54,12 +54,14 @@ function dynamicImport(
|
||||
if (matchKeys?.length === 1) {
|
||||
const matchKey = matchKeys[0];
|
||||
return dynamicViewsModules[matchKey];
|
||||
}
|
||||
if (matchKeys?.length > 1) {
|
||||
} else if (matchKeys?.length > 1) {
|
||||
warn(
|
||||
'Please do not create `.vue` and `.TSX` files with the same file name in the same hierarchical directory under the views folder. This will cause dynamic introduction failure',
|
||||
);
|
||||
return;
|
||||
} else {
|
||||
warn('在src/views/下找不到`' + component + '.vue` 或 `' + component + '.TSX`, 请自行创建!');
|
||||
return EXCEPTION_COMPONENT;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user