This commit is contained in:
syuilo
2025-03-19 15:17:41 +09:00
parent 11378b17c5
commit bdc72e5817
6 changed files with 21 additions and 69 deletions

View File

@@ -19,15 +19,15 @@ export function setupRouter(app: App, routerFactory: ((path: string) => IRouter)
const mainRouter = routerFactory(location.pathname + location.search + location.hash);
window.addEventListener('popstate', (event) => {
mainRouter.replace(location.pathname + location.search + location.hash, event.state?.key);
mainRouter.replace(location.pathname + location.search + location.hash);
});
mainRouter.addListener('push', ctx => {
window.history.pushState({ key: ctx.key }, '', ctx.path);
window.history.pushState({ }, '', ctx.path);
});
mainRouter.addListener('replace', ctx => {
window.history.replaceState({ key: ctx.key }, '', ctx.path);
window.history.replaceState({ }, '', ctx.path);
});
mainRouter.addListener('change', ctx => {
@@ -96,10 +96,6 @@ class MainRouterProxy implements IRouter {
this.supplier().navHook = value;
}
getCurrentKey(): string {
return this.supplier().getCurrentKey();
}
getCurrentPath(): string {
return this.supplier().getCurrentPath();
}