fix(nuxt): align type of custom navigate with vue-router

This commit is contained in:
Daniel Roe 2025-03-01 00:40:07 +00:00
parent b2559e8277
commit 7a1934509e
No known key found for this signature in database
GPG Key ID: CBC814C393D93268

View File

@ -110,7 +110,7 @@ export interface NuxtLinkOptions extends
type NuxtLinkDefaultSlotProps<CustomProp extends boolean = false> = CustomProp extends true
? {
href: string
navigate: () => Promise<void>
navigate: (e?: MouseEvent) => Promise<void>
prefetch: (nuxtApp?: NuxtApp) => Promise<void>
route: (RouteLocation & { href: string }) | undefined
rel: string | null
@ -233,7 +233,7 @@ export function defineNuxtLink (options: NuxtLinkOptions) {
isActive: link?.isActive ?? computed(() => to.value === router.currentRoute.value.path),
isExactActive: link?.isExactActive ?? computed(() => to.value === router.currentRoute.value.path),
route: link?.route ?? computed(() => router.resolve(to.value)),
async navigate () {
async navigate (_e?: MouseEvent) {
await navigateTo(href.value, { replace: props.replace, external: isExternal.value || hasTarget.value })
},
} satisfies ReturnType<typeof useLink> & {