From 5be56bb80ec7cea2e5f0d7bc672375c082072ec1 Mon Sep 17 00:00:00 2001 From: thislight Date: Sat, 16 Nov 2024 22:37:22 +0800 Subject: [PATCH] A: fix missolved path --- src/platform/A.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/platform/A.tsx b/src/platform/A.tsx index b655dc9..3d0b33d 100644 --- a/src/platform/A.tsx +++ b/src/platform/A.tsx @@ -1,5 +1,6 @@ -import { type JSX } from "solid-js"; +import { splitProps, type JSX } from "solid-js"; import { useNavigator } from "./StackedRouter"; +import { useResolvedPath } from "@solidjs/router"; function handleClick( push: (name: string, state: unknown) => void, @@ -7,13 +8,14 @@ function handleClick( ) { const target = event.currentTarget; event.preventDefault(); - event.stopPropagation(); push(target.href, { state: target.getAttribute("state") || undefined }); } -const A = (oprops: JSX.HTMLElementTags["a"]) => { +const A = (oprops: Omit) => { + const [props, rest] = splitProps(oprops, ["href"]); + const resolvedPath = useResolvedPath(() => props.href || "#"); const { push } = useNavigator(); - return ; + return ; }; export default A;