Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

一个建议 #3

Open
tKlint opened this issue Sep 2, 2022 · 1 comment
Open

一个建议 #3

tKlint opened this issue Sep 2, 2022 · 1 comment

Comments

@tKlint
Copy link
Contributor

tKlint commented Sep 2, 2022

在文件/src/routes/modules/system.ts中定义了一个对象来作为异步组件的映射

export default {
'views/system/permission/user': lazy(() => import('@/views/system/permission/user')),
'views/system/permission/menu': lazy(() => import('@/views/system/permission/menu')),
'views/system/permission/role': lazy(() => import('@/views/system/permission/role')),
'views/system/monitor/req-log': lazy(() => import('@/views/system/monitor/req-log')),
'views/system/monitor/online': lazy(() => import('@/views/system/monitor/online')),
'views/system/monitor/serve': lazy(() => import('@/views/system/monitor/serve')),
'views/system/monitor/login-log': lazy(() => import('@/views/system/monitor/login-log')),
'views/system/schedule/task': lazy(() => import('@/views/system/schedule/task')),
'views/system/schedule/log': lazy(() => import('@/views/system/schedule/log'))
};

为什么不直接从import.meta.globEager('../../views/**/*.ts')中获取呢

@buqiyuan
Copy link
Owner

感谢建议!确实以这种自动扫描导入的方式会更方便,当初这样做好像是为了显示控制那些菜单是可以被用户选择的,如下图:
image
如果用import.meta.globEager('../../views/**/*.ts')的话,就会无差别的导入了吧?当然我们可以选择性的过滤/匹配出实际需要的,嗯~这个后面有时间的话 可能会重构整个项目

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants