优化
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
const viewModules = import.meta.glob('../view/**/*.vue')
|
||||
const moduleViews = import.meta.glob('../modules/**/*.vue')
|
||||
const legacyModuleComponents = {
|
||||
'plugin/email/view/index.vue': 'modules/email/view/index.vue',
|
||||
'plugin/announcement/view/info.vue': 'modules/announcement/view/info.vue',
|
||||
'plugin/announcement/form/info.vue': 'modules/announcement/form/info.vue'
|
||||
}
|
||||
|
||||
export const asyncRouterHandle = (asyncRouter) => {
|
||||
asyncRouter.forEach((item) => {
|
||||
if (item.component && typeof item.component === 'string') {
|
||||
item.meta.path = '/src/' + item.component
|
||||
if (item.component.split('/')[0] === 'view') {
|
||||
item.component = dynamicImport(viewModules, item.component)
|
||||
} else if (item.component.split('/')[0] === 'modules') {
|
||||
item.component = dynamicImport(moduleViews, item.component)
|
||||
const component = legacyModuleComponents[item.component] || item.component
|
||||
item.meta.path = '/src/' + component
|
||||
if (component.split('/')[0] === 'view') {
|
||||
item.component = dynamicImport(viewModules, component)
|
||||
} else if (component.split('/')[0] === 'modules') {
|
||||
item.component = dynamicImport(moduleViews, component)
|
||||
}
|
||||
}
|
||||
if (item.children) {
|
||||
|
||||
Reference in New Issue
Block a user