This commit is contained in:
张成
2025-11-13 11:42:24 +08:00
parent 2066796977
commit ae36d6da81
3 changed files with 10 additions and 2 deletions

View File

@@ -174,6 +174,7 @@ const app = AdminFramework.createApp({
'order/pay_orders': PayOrdersComponent
// 添加更多业务组件...
},
HomePage: CustomHomePage, // 可选:自定义首页组件,覆盖整个首页
onReady() {
console.log('应用已启动!')
}

View File

@@ -44,6 +44,7 @@ class AdminFramework {
this.config = {}
this.store = null
this.router = null
this.HomePage = pages.HomePage // 默认使用框架内置的 HomePage
this.tools = tools
this.uiTool = uiTool
@@ -93,6 +94,7 @@ class AdminFramework {
* @param {String} config.apiUrl - API base URL
* @param {String} config.uploadUrl - upload URL (可选,默认为 apiUrl + 'upload')
* @param {Object} config.componentMap - custom component map (optional)
* @param {Component} config.HomePage - custom home page component (optional)
* @param {Function} config.onReady - callback when app is ready (optional)
* @returns {Object} Vue instance
*/
@@ -102,6 +104,11 @@ class AdminFramework {
config.uploadUrl = config.apiUrl + (config.apiUrl.endsWith('/') ? 'upload' : '/upload')
}
// 如果提供了自定义 HomePage使用自定义的否则使用默认的
if (config.HomePage) {
this.HomePage = config.HomePage
}
// 设置配置
this.config = config

View File

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