mirror of
https://github.com/nuxt/nuxt.git
synced 2025-03-21 16:55:57 +00:00
fix(nuxt): align type of custom navigate
with vue-router
This commit is contained in:
parent
b2559e8277
commit
7a1934509e
@ -110,7 +110,7 @@ export interface NuxtLinkOptions extends
|
|||||||
type NuxtLinkDefaultSlotProps<CustomProp extends boolean = false> = CustomProp extends true
|
type NuxtLinkDefaultSlotProps<CustomProp extends boolean = false> = CustomProp extends true
|
||||||
? {
|
? {
|
||||||
href: string
|
href: string
|
||||||
navigate: () => Promise<void>
|
navigate: (e?: MouseEvent) => Promise<void>
|
||||||
prefetch: (nuxtApp?: NuxtApp) => Promise<void>
|
prefetch: (nuxtApp?: NuxtApp) => Promise<void>
|
||||||
route: (RouteLocation & { href: string }) | undefined
|
route: (RouteLocation & { href: string }) | undefined
|
||||||
rel: string | null
|
rel: string | null
|
||||||
@ -233,7 +233,7 @@ export function defineNuxtLink (options: NuxtLinkOptions) {
|
|||||||
isActive: link?.isActive ?? computed(() => to.value === router.currentRoute.value.path),
|
isActive: link?.isActive ?? computed(() => to.value === router.currentRoute.value.path),
|
||||||
isExactActive: link?.isExactActive ?? 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)),
|
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 })
|
await navigateTo(href.value, { replace: props.replace, external: isExternal.value || hasTarget.value })
|
||||||
},
|
},
|
||||||
} satisfies ReturnType<typeof useLink> & {
|
} satisfies ReturnType<typeof useLink> & {
|
||||||
|
Loading…
Reference in New Issue
Block a user