| | |
| | | import { createRoot } from 'react-dom/client'; |
| | | import './index.css'; |
| | | import App from './App'; |
| | | import { SideMenuPage } from './pages/side-menu/SideMenuPage'; |
| | | |
| | | createRoot(document.getElementById('root')!).render(<App />); |
| | | /** 预览页面 - 无 shell,直接渲染组件 */ |
| | | function PreviewPage() { |
| | | const hash = window.location.hash; |
| | | const path = hash.replace('#/preview/', ''); |
| | | |
| | | if (path.includes('side-menu')) { |
| | | return <SideMenuPage />; |
| | | } |
| | | |
| | | return <div>Unknown component</div>; |
| | | } |
| | | |
| | | const root = createRoot(document.getElementById('root')!); |
| | | |
| | | // 检查是否是预览模式 |
| | | if (window.location.hash.includes('/preview/')) { |
| | | root.render(<PreviewPage />); |
| | | } else { |
| | | root.render(<App />); |
| | | } |