AdmSysV2【公共组件库】@前端(For Git Submodule)
Tevin
2 days ago fb6b8a6aecdc110fd700953f42396846165f93f1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { createRoot } from 'react-dom/client';
import './index.css';
import App from './App';
import { SideMenuPage } from './pages/side-menu/SideMenuPage';
 
/** 预览页面 - 无 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 />);
}