perf(frontend): 路由级代码分割 — React.lazy + Suspense
将所有页面组件改为按路由懒加载,Layout 组件保持静态导入。 新增 LoadingSpinner 作为 Suspense 回退组件。 html5-qrcode (~200KB) 和 antd 仅在访问扫码/管理后台路由时加载。
This commit is contained in:
10
frontend/src/components/ui/LoadingSpinner.tsx
Normal file
10
frontend/src/components/ui/LoadingSpinner.tsx
Normal file
@ -0,0 +1,10 @@
|
||||
import { Loader2 } from "lucide-react";
|
||||
|
||||
/** 全局路由懒加载回退组件 */
|
||||
export default function LoadingSpinner() {
|
||||
return (
|
||||
<div className="flex items-center justify-center py-32">
|
||||
<Loader2 className="h-8 w-8 animate-spin text-blue-500" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user