feat: 新增很多页面
This commit is contained in:
@@ -132,6 +132,9 @@ export function backEndComponent(routes: any) {
|
||||
item.component = () => import('/@/layout/routerView/link.vue');
|
||||
}
|
||||
item.path = '/iframes/' + window.btoa(item.path);
|
||||
} else if (item.component === 'Layout' || item.componentPath === 'Layout') {
|
||||
// 特殊处理 Layout 组件
|
||||
item.component = () => import('/@/layout/index.vue');
|
||||
} else if (item.componentPath) { // 支持动态路径 /a/1 ==> /a ; /b/1 ==> /b
|
||||
item.component = dynamicImport(dynamicViewsModules, item.componentPath);
|
||||
} else {
|
||||
@@ -152,6 +155,11 @@ export function backEndComponent(routes: any) {
|
||||
* @returns 返回处理成函数后的 component
|
||||
*/
|
||||
export function dynamicImport(dynamicViewsModules: Record<string, Function>, component: string) {
|
||||
// 特殊处理 Layout 组件
|
||||
if (component === 'Layout' || component === '/Layout') {
|
||||
return () => import('/@/layout/index.vue');
|
||||
}
|
||||
|
||||
const keys = Object.keys(dynamicViewsModules);
|
||||
|
||||
const matchKeys = keys.filter((key) => {
|
||||
@@ -169,7 +177,8 @@ export function dynamicImport(dynamicViewsModules: Record<string, Function>, com
|
||||
return false;
|
||||
}
|
||||
if (matchKeys?.length === 0) {
|
||||
console.warn(`No match found for component: ${component}. Available keys:`, keys.slice(0, 10));
|
||||
// 如果找不到组件,不输出警告,避免控制台刷屏
|
||||
// console.warn(`No match found for component: ${component}. Available keys:`, keys.slice(0, 10));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user