This commit is contained in:
张成
2025-10-09 18:43:34 +08:00
parent fffdb69815
commit 910992e192
2 changed files with 38 additions and 4 deletions

View File

@@ -94,8 +94,10 @@ export default {
// 保存权限菜单
commit('setAuthorityMenus', JSON.stringify(menus))
// 生成路由菜单
let mainMenu = uiTool.getRoutes(Main, ParentView, Page404)
// 生成路由菜单(传递 HomePage 组件)
// 从框架导出的组件中获取 HomePage
const HomePage = window.framework && window.framework.HomePage ? window.framework.HomePage : null
let mainMenu = uiTool.getRoutes(Main, ParentView, Page404, HomePage)
console.log('生成的主菜单:', mainMenu)
if (mainMenu && mainMenu.children) {

View File

@@ -214,6 +214,39 @@ export default class uiTool {
}
static getRoutes(Main, ParentView, Page404, HomePage) {
// 如果没有传入 HomePage使用默认的欢迎页面
const defaultHomePage = {
render: h => h('div', {
style: {
padding: '20px',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
height: 'calc(100vh - 200px)'
}
}, [
h('div', {
style: {
textAlign: 'center'
}
}, [
h('h1', {
style: {
fontSize: '30px',
color: '#2d8cf0',
marginBottom: '20px'
}
}, '欢迎使用管理系统'),
h('p', {
style: {
fontSize: '16px',
color: '#666'
}
}, '请从左侧菜单选择功能模块')
])
])
}
let mainRoute = {
path: '/',
name: '主视图',
@@ -224,10 +257,9 @@ export default class uiTool {
{
path: '/home',
name: '首页',
component: HomePage,
component: HomePage || defaultHomePage,
meta: { title: '首页', notCache: true }
}
]
}