上传新增文件
This commit is contained in:
@@ -156,13 +156,20 @@ export function dynamicImport(dynamicViewsModules: Record<string, Function>, com
|
||||
|
||||
const matchKeys = keys.filter((key) => {
|
||||
const k = key.replace(/..\/views|../, '');
|
||||
return k.startsWith(`${component}.vue`);
|
||||
// 支持路径格式:/stuwork/weekPlan/index 或 stuwork/weekPlan/index
|
||||
const normalizedComponent = component.startsWith('/') ? component : `/${component}`;
|
||||
return k.startsWith(`${normalizedComponent}.vue`) || k.startsWith(`${component}.vue`);
|
||||
});
|
||||
if (matchKeys?.length === 1) {
|
||||
const matchKey = matchKeys[0];
|
||||
return dynamicViewsModules[matchKey];
|
||||
}
|
||||
if (matchKeys?.length > 1) {
|
||||
console.warn(`Multiple matches found for component: ${component}`, matchKeys);
|
||||
return false;
|
||||
}
|
||||
if (matchKeys?.length === 0) {
|
||||
console.warn(`No match found for component: ${component}. Available keys:`, keys.slice(0, 10));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user