You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

33 lines
1.0 KiB

const viewsModules: Recordable<() => Promise<Recordable>> = import.meta.glob(
'/src/view/**/*.{vue,tsx}'
);
viewsModules['/saas/view/system/application.vue'] = () =>
import('/nerv-lib/saas/view/system/application.vue');
viewsModules['/saas/view/system/layout/content.vue'] = () =>
import('/nerv-lib/saas/view/system/layout/content.vue');
viewsModules['/saas/view/menuManage/index.vue'] = () =>
import('/nerv-lib/saas/view/menuManage/index.vue');
const viewsModulesKeys = Object.keys(viewsModules);
function getComponent(component: string): string | undefined {
const key = viewsModulesKeys.find((key) => {
return component.includes(key);
});
// !key && console.log('key', component);
return key;
}
function dynamicImportRoute(component: string) {
const dynamicComponent = viewsModules[component];
if (dynamicComponent) {
return dynamicComponent;
} else {
console.error(`can't find ${component}`);
return viewsModules['/saas/view/system/layout/content.vue'];
}
}
export { viewsModules, getComponent, dynamicImportRoute };