|
@@ -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;
|
|
|
}
|
|
|
}
|
|
|
|