Skip to content

Commit

Permalink
Docs: Improve click tracking example
Browse files Browse the repository at this point in the history
  • Loading branch information
tordans authored May 20, 2024
1 parent 7320b94 commit 6b51a47
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 6b51a47

Please sign in to comment.