1
This commit is contained in:
@@ -94,8 +94,10 @@ export default {
|
|||||||
// 保存权限菜单
|
// 保存权限菜单
|
||||||
commit('setAuthorityMenus', JSON.stringify(menus))
|
commit('setAuthorityMenus', JSON.stringify(menus))
|
||||||
|
|
||||||
// 生成路由菜单
|
// 生成路由菜单(传递 HomePage 组件)
|
||||||
let mainMenu = uiTool.getRoutes(Main, ParentView, Page404)
|
// 从框架导出的组件中获取 HomePage
|
||||||
|
const HomePage = window.framework && window.framework.HomePage ? window.framework.HomePage : null
|
||||||
|
let mainMenu = uiTool.getRoutes(Main, ParentView, Page404, HomePage)
|
||||||
console.log('生成的主菜单:', mainMenu)
|
console.log('生成的主菜单:', mainMenu)
|
||||||
|
|
||||||
if (mainMenu && mainMenu.children) {
|
if (mainMenu && mainMenu.children) {
|
||||||
|
|||||||
@@ -214,6 +214,39 @@ export default class uiTool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static getRoutes(Main, ParentView, Page404, HomePage) {
|
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 = {
|
let mainRoute = {
|
||||||
path: '/',
|
path: '/',
|
||||||
name: '主视图',
|
name: '主视图',
|
||||||
@@ -224,10 +257,9 @@ export default class uiTool {
|
|||||||
{
|
{
|
||||||
path: '/home',
|
path: '/home',
|
||||||
name: '首页',
|
name: '首页',
|
||||||
component: HomePage,
|
component: HomePage || defaultHomePage,
|
||||||
meta: { title: '首页', notCache: true }
|
meta: { title: '首页', notCache: true }
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user