Skip to content

Commit a06b42b

Browse files
fix: re-add link click handling to utilize Nuxt router
Co-authored-by: Daniel Roe <daniel@roe.dev>
1 parent 495d99e commit a06b42b

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

app/components/Readme.vue

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ defineProps<{
33
html: string
44
}>()
55
6+
const router = useRouter()
67
const { copy } = useClipboard()
78
89
// Combined click handler for:
@@ -38,6 +39,20 @@ function handleClick(event: MouseEvent) {
3839
}, 2000)
3940
return
4041
}
42+
43+
// Handle npmjs.com link clicks - route internally
44+
const anchor = target.closest('a')
45+
if (!anchor) return
46+
47+
const href = anchor.getAttribute('href')
48+
if (!href) return
49+
50+
// Handle relative anchor links
51+
if (href.startsWith('#') || href.startsWith('/')) {
52+
event.preventDefault()
53+
router.push(href)
54+
return
55+
}
4156
}
4257
</script>
4358

0 commit comments

Comments
 (0)