Files
vf_react/src/routes/lazy-components.js
2025-10-31 10:33:53 +08:00

63 lines
2.1 KiB
JavaScript

// src/routes/lazy-components.js
// 集中管理所有懒加载组件
import React from 'react';
/**
* 懒加载组件配置
* 使用 React.lazy() 实现路由懒加载,大幅减少初始 JS 包大小
*/
export const lazyComponents = {
// Home 模块
HomePage: React.lazy(() => import('../views/Home/HomePage')),
CenterDashboard: React.lazy(() => import('../views/Dashboard/Center')),
ProfilePage: React.lazy(() => import('../views/Profile/ProfilePage')),
SettingsPage: React.lazy(() => import('../views/Settings/SettingsPage')),
Subscription: React.lazy(() => import('../views/Pages/Account/Subscription')),
PrivacyPolicy: React.lazy(() => import('../views/Pages/PrivacyPolicy')),
UserAgreement: React.lazy(() => import('../views/Pages/UserAgreement')),
WechatCallback: React.lazy(() => import('../views/Pages/WechatCallback')),
// 社区/内容模块
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 {
HomePage,
CenterDashboard,
ProfilePage,
SettingsPage,
Subscription,
PrivacyPolicy,
UserAgreement,
WechatCallback,
Community,
ConceptCenter,
StockOverview,
LimitAnalyse,
TradingSimulation,
EventDetail,
CompanyIndex,
ForecastReport,
FinancialPanorama,
MarketDataView,
} = lazyComponents;