mirror of
https://github.com/lainbo/component-party.git
synced 2026-04-05 04:59:02 +08:00
fix(app): fix router lookup on search params
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<footer class="bg-gray-900 pb-20">
|
||||
<h2 id="footer-heading" class="sr-only">Footer</h2>
|
||||
<div class="mx-auto max-w-7xl px-6 pb-8 pt-16 sm:pt-24 lg:px-8 lg:pt-32">
|
||||
<footer class="bg-gray-900">
|
||||
<h2 class="sr-only">Footer</h2>
|
||||
<div class="mx-auto max-w-7xl px-6 pb-20 pt-16 sm:pt-24 lg:px-8">
|
||||
<div class="xl:grid xl:grid-cols-3 xl:gap-8">
|
||||
<div class="space-y-8">
|
||||
<a class="font-semibold text-xl flex items-center space-x-3" href="/">
|
||||
|
||||
@@ -95,11 +95,11 @@
|
||||
}
|
||||
|
||||
if (frameworkIdsSelectedOnInit.length === 0) {
|
||||
const frameworkIdsFromStorage = frameworkIdsStorage.getJSON();
|
||||
const frameworkIdsFromStorage = frameworkIdsStorage
|
||||
.getJSON()
|
||||
?.filter(matchFrameworkId);
|
||||
if (frameworkIdsFromStorage?.length > 0) {
|
||||
frameworkIdsSelectedOnInit = frameworkIdsFromStorage.map((x) =>
|
||||
x === "svelte" ? "svelte4" : x
|
||||
);
|
||||
frameworkIdsSelectedOnInit = frameworkIdsFromStorage;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
const currentRoute = writable({ component: null });
|
||||
|
||||
function navigate(path) {
|
||||
const routePayload = router.lookup(path);
|
||||
const urlParsed = new URL(path);
|
||||
const routePayload = router.lookup(urlParsed.pathname);
|
||||
if (routePayload) {
|
||||
if (routePayload.component.toString().startsWith("class")) {
|
||||
currentRoute.set(routePayload);
|
||||
@@ -36,7 +37,7 @@
|
||||
}
|
||||
|
||||
window.onpopstate = () => {
|
||||
navigate(window.location.pathname);
|
||||
navigate(window.location.href);
|
||||
};
|
||||
|
||||
function handleClick(event) {
|
||||
@@ -53,7 +54,7 @@
|
||||
|
||||
onMount(() => {
|
||||
document.addEventListener("click", handleClick);
|
||||
navigate(window.location.pathname);
|
||||
navigate(window.location.href);
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
|
||||
Reference in New Issue
Block a user