Skip to content

Commit

Permalink
Use NuxtLink in nuxt applications
Browse files Browse the repository at this point in the history
  • Loading branch information
d0rich committed Nov 11, 2023
1 parent 19b6d00 commit 6bf2fc0
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/esprit-design/src/composables/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check failure on line 18 in packages/esprit-design/src/composables/router.ts

View workflow job for this annotation

GitHub Actions / test

Insert `?·`
? (defineNuxtLink({

Check failure on line 19 in packages/esprit-design/src/composables/router.ts

View workflow job for this annotation

GitHub Actions / test

Replace `?` with `·`
componentName: 'DNuxtLink'
}) as typeof _RouterLink)
: undefined

const isLink = computed(() => !!(props.href || props.to))
const isExternalLink = computed(() => {
Expand All @@ -28,7 +33,7 @@ export function useLink(props: LinkProps) {
)
})

if (typeof NuxtLink !== 'string') {
if (typeof NuxtLink !== 'undefined') {
return {
isLink,
isExternalLink,
Expand Down

0 comments on commit 6bf2fc0

Please sign in to comment.