mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-11 01:33:21 +08:00
Fix route -> page binding
This commit is contained in:
parent
8f74168a23
commit
4231b26eea
@ -14,6 +14,19 @@ export function setup(): void {
|
|||||||
window.onpopstate = (event) => {
|
window.onpopstate = (event) => {
|
||||||
navigate(event.state, false);
|
navigate(event.state, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
// Check if the window's href is a page.
|
||||||
|
const page = window.location.href.split("/").pop();
|
||||||
|
if (page == undefined) return;
|
||||||
|
|
||||||
|
// Convert the page to a Page type.
|
||||||
|
const pageName = page.charAt(0).toUpperCase() + page.slice(1);
|
||||||
|
const pageType = pageName as Page;
|
||||||
|
|
||||||
|
// Navigate to the page.
|
||||||
|
navigate(pageType, false);
|
||||||
|
}, 3e2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user