Files
page-agent/pages/main.tsx
2025-09-29 16:33:15 +08:00

31 lines
862 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import { Route, Router, Switch } from 'wouter'
import { useHashLocation } from 'wouter/use-hash-location'
import { default as PagesRouter } from './router.tsx'
import { default as TestPagesRouter } from './test-pages/router.tsx'
import './index.css'
let baseURL: string
// 如果是 localhost就用 /
// 如果是其他环境,阶段到 index.html
if (window.location.hostname === 'localhost') {
baseURL = '/'
} else {
baseURL = window.location.pathname.split('index.html')[0] + 'index.html'
}
createRoot(document.getElementById('root')!).render(
// <StrictMode>
<Router hook={useHashLocation}>
<Switch>
<Route path="/test-pages" component={TestPagesRouter} nest />
<Route path="/" component={PagesRouter} nest />
</Switch>
</Router>
// </StrictMode>
)