使用useHashLocation钩子更新路由配置,以支持哈希路由

This commit is contained in:
yangy
2026-04-30 10:59:50 +08:00
parent 90bd091c62
commit 0262619d03
+2 -1
View File
@@ -1,6 +1,7 @@
import { Toaster } from "@/components/ui/sonner"; import { Toaster } from "@/components/ui/sonner";
import { TooltipProvider } from "@/components/ui/tooltip"; import { TooltipProvider } from "@/components/ui/tooltip";
import { Route, Switch, Router } from "wouter"; import { Route, Switch, Router } from "wouter";
import { useHashLocation } from "wouter/use-hash-location";
import ErrorBoundary from "./components/ErrorBoundary"; import ErrorBoundary from "./components/ErrorBoundary";
import { ThemeProvider } from "./contexts/ThemeContext"; import { ThemeProvider } from "./contexts/ThemeContext";
import { DeviceProvider } from "./contexts/DeviceContext"; import { DeviceProvider } from "./contexts/DeviceContext";
@@ -50,7 +51,7 @@ function App() {
<DeviceProvider> <DeviceProvider>
<TooltipProvider> <TooltipProvider>
<Toaster /> <Toaster />
<Router base="/x8/v2/public"> <Router hook={useHashLocation}>
{/* Desktop: narrow shell centered in the browser with side gutters */} {/* Desktop: narrow shell centered in the browser with side gutters */}
<div className="min-h-dvh bg-[#0d1117]"> <div className="min-h-dvh bg-[#0d1117]">
<div className="mx-auto min-h-dvh w-full max-w-full lg:max-w-[min(1180px,calc(100vw-3rem))]"> <div className="mx-auto min-h-dvh w-full max-w-full lg:max-w-[min(1180px,calc(100vw-3rem))]">