mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-14 18:13:54 +00:00
fix(nuxt): pass absolute external link urls to link:prefetch
(#29321)
This commit is contained in:
parent
92b427ce81
commit
43f80f134b
@ -328,8 +328,9 @@ export function defineNuxtLink (options: NuxtLinkOptions) {
|
|||||||
const path = typeof to.value === 'string'
|
const path = typeof to.value === 'string'
|
||||||
? to.value
|
? to.value
|
||||||
: isExternal.value ? resolveRouteObject(to.value) : router.resolve(to.value).fullPath
|
: isExternal.value ? resolveRouteObject(to.value) : router.resolve(to.value).fullPath
|
||||||
|
const normalizedPath = isExternal.value ? new URL(path, window.location.href).href : path
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
nuxtApp.hooks.callHook('link:prefetch', path).catch(() => {}),
|
nuxtApp.hooks.callHook('link:prefetch', normalizedPath).catch(() => {}),
|
||||||
!isExternal.value && !hasTarget.value && preloadRouteComponents(to.value as string, router).catch(() => {}),
|
!isExternal.value && !hasTarget.value && preloadRouteComponents(to.value as string, router).catch(() => {}),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user