perf: permission loadView避免整个modules循环,允许view中间有views文件夹
This commit is contained in:
parent
9a02598c00
commit
b8953561a0
@ -158,9 +158,12 @@ export const filterDynamicRoutes = (routes: RouteRecordRaw[]) => {
|
||||
export const loadView = (view: any, name: string) => {
|
||||
let res;
|
||||
for (const path in modules) {
|
||||
const dir = path.split('views/')[1].split('.vue')[0];
|
||||
const viewIndex = path.indexOf('/views/');
|
||||
let dir = path.substring(viewIndex + 7);
|
||||
dir = dir.substring(0, dir.lastIndexOf('.vue'));
|
||||
if (dir === view) {
|
||||
res = createCustomNameComponent(modules[path], { name });
|
||||
return res;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
Loading…
x
Reference in New Issue
Block a user