f6a669070d
控制台从 useState 切 tab + 硬编码条件渲染,改为路由注册表驱动 + 真实 URL 路由, 加页面只需在 routes.tsx 加一条,不动外壳。 - 依赖 react-router-dom v7;App=HashRouter(静态托管/桌面内嵌都能深链) - routes.tsx:路由注册表(单一事实源,导航+内容都派生);real 页面 lazy 懒加载(代码分割) - shell/AppShell:NavLink 分组导航(配置/平台) + Routes + Suspense + 健康灯,全从注册表派生 - 页面归入 pages/(ModelsPage 移入),components/Soon 占位复用 - 验证:npm build✓(ModelsPage 独立 chunk=懒加载生效);真实浏览器——默认重定向 #/models、 nav 切换改 URL hash、深链 #/guardrails 直达、浏览器后退回 #/datasources、active 高亮 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
12 lines
291 B
TypeScript
12 lines
291 B
TypeScript
import { HashRouter } from "react-router-dom";
|
|
import { AppShell } from "./shell/AppShell";
|
|
|
|
// 用 HashRouter:纯静态托管/桌面内嵌都能深链,无需服务端路由配置。
|
|
export default function App() {
|
|
return (
|
|
<HashRouter>
|
|
<AppShell />
|
|
</HashRouter>
|
|
);
|
|
}
|