Skip to content

Commit

Permalink
chore: empty string to represent real empty to
Browse files Browse the repository at this point in the history
  • Loading branch information
yuwu9145 committed Apr 16, 2024
1 parent 6063489 commit ac10712
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/vuetify/src/composables/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,15 @@ export function useLink (props: LinkProps & LinkListeners, attrs: SetupContext['
href: toRef(props, 'href'),
}
}

// vue-router useLink `to` prop needs to be reactive and useLink will crash if undefined
const link = computed(() => props.to ? RouterLink.useLink(props as UseLinkOptions) : undefined)
const linkProps = computed(() => ({
...props,
to: toRef(() => props.to || ''),
}))

const routerLink = RouterLink.useLink(linkProps.value as UseLinkOptions)
// Actual link needs to be undefined when to prop is not used
const link = computed(() => props.to ? routerLink : undefined)

const route = useRoute()

Expand Down

0 comments on commit ac10712

Please sign in to comment.