From 6bf2fc0172abd3dca5b31d5d2b919561cef8f754 Mon Sep 17 00:00:00 2001 From: Nikolay Dorofeev Date: Sat, 11 Nov 2023 16:46:41 +0400 Subject: [PATCH] Use NuxtLink in nuxt applications --- packages/esprit-design/src/composables/router.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/esprit-design/src/composables/router.ts b/packages/esprit-design/src/composables/router.ts index c2030958..398428d9 100644 --- a/packages/esprit-design/src/composables/router.ts +++ b/packages/esprit-design/src/composables/router.ts @@ -12,9 +12,14 @@ export function useLink(props: LinkProps) { const RouterLink = resolveDynamicComponent('RouterLink') as | typeof _RouterLink | string - const NuxtLink = resolveDynamicComponent('NuxtLink') as - | typeof _RouterLink - | string + const NuxtLink = + // @ts-ignore + typeof defineNuxtLink === 'function' + // @ts-ignore + ? (defineNuxtLink({ + componentName: 'DNuxtLink' + }) as typeof _RouterLink) + : undefined const isLink = computed(() => !!(props.href || props.to)) const isExternalLink = computed(() => { @@ -28,7 +33,7 @@ export function useLink(props: LinkProps) { ) }) - if (typeof NuxtLink !== 'string') { + if (typeof NuxtLink !== 'undefined') { return { isLink, isExternalLink,