23 lines
535 B
JavaScript
23 lines
535 B
JavaScript
// 合并常用的JS文件以减少HTTP请求
|
|
// 这个文件可以作为后续优化的起点
|
|
|
|
// 1. 首先加载核心模块
|
|
import('./router.js');
|
|
import('./api.js');
|
|
|
|
// 2. 延迟加载其他模块
|
|
setTimeout(() => {
|
|
import('./components/sidebar.js');
|
|
import('./components/menu-search.js');
|
|
import('./components/dashboard.js');
|
|
import('./components/notifications.js');
|
|
}, 0);
|
|
|
|
// 3. 按需加载其他组件
|
|
const lazyLoad = (path) => {
|
|
return () => import(path);
|
|
};
|
|
|
|
// 导出懒加载函数
|
|
window.lazyLoad = lazyLoad;
|