fix(X-Pack): 同步管理菜单无法展示

This commit is contained in:
fit2cloud-chenyw 2024-06-25 09:53:26 +08:00
parent 1a3090b7c6
commit 7988fd2106

View File

@ -4,6 +4,7 @@ import { XpackComponent } from '@/components/plugin'
const modules = import.meta.glob('../views/**/*.vue')
export const Layout = () => import('@/layout/index.vue')
const xpackComName = 'components/plugin'
export const LayoutTransition = () => import('@/layout/components/LayoutTransition.vue')
// 后端控制路由生成
export const generateRoutesFn2 = (routes: AppCustomRouteRecordRaw[]): AppRouteRecordRaw[] => {
const res: AppRouteRecordRaw[] = []
@ -37,12 +38,14 @@ export const generateRoutesFn2 = (routes: AppCustomRouteRecordRaw[]): AppRouteRe
let comModule = null
if (route.component === xpackComName) {
comModule = XpackComponent
} else {
} else if (!route.component.startsWith('Layout')) {
comModule = modules[`../views/${route.component}/index.vue`]
}
if (route.component === 'Layout') {
data.component = Layout
} else if (route.component === 'LayoutTransition') {
data.component = LayoutTransition
} else if (!comModule) {
} else {
data.component = comModule