feat: 创建声明式路由配置系统'

This commit is contained in:
zdl
2025-10-30 14:37:20 +08:00
parent d5881462d2
commit b29c37149a
3 changed files with 335 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
// src/routes/lazy-components.js
// 集中管理所有懒加载组件
import React from 'react';
/**
* 懒加载组件配置
* 使用 React.lazy() 实现路由懒加载,大幅减少初始 JS 包大小
*/
export const lazyComponents = {
// 社区/内容模块
Community: React.lazy(() => import('../views/Community')),
ConceptCenter: React.lazy(() => import('../views/Concept')),
StockOverview: React.lazy(() => import('../views/StockOverview')),
LimitAnalyse: React.lazy(() => import('../views/LimitAnalyse')),
// 交易模块
TradingSimulation: React.lazy(() => import('../views/TradingSimulation')),
// 事件模块
EventDetail: React.lazy(() => import('../views/EventDetail')),
// 公司相关模块
CompanyIndex: React.lazy(() => import('../views/Company')),
ForecastReport: React.lazy(() => import('../views/Company/ForecastReport')),
FinancialPanorama: React.lazy(() => import('../views/Company/FinancialPanorama')),
MarketDataView: React.lazy(() => import('../views/Company/MarketDataView')),
};
/**
* 按需导出单个组件(可选)
*/
export const {
Community,
ConceptCenter,
StockOverview,
LimitAnalyse,
TradingSimulation,
EventDetail,
CompanyIndex,
ForecastReport,
FinancialPanorama,
MarketDataView,
} = lazyComponents;