From dfcf60fee055ad5a03ca5415010a1a943df87124 Mon Sep 17 00:00:00 2001 From: Tobias Date: Mon, 20 May 2024 10:41:51 +0200 Subject: [PATCH] Docs: Improve click tracking example --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 46d77b6..268290e 100644 --- a/README.md +++ b/README.md @@ -157,10 +157,10 @@ You can disable this behavior by `links: false` options and create custom export const $router = createRouter({ … }, { links: false }) function onClick (e) { - let link = event.target.closest('a') - if (isPjax(link, e)) { - $router.open(new Url(link.href).pathname) - } + e.preventDefault() + let path = new Url(event.target.href).pathname + let params = $router.get()?.search + openPage($router, '…', { }, { ...params }) } export const Link = (props) => {