fix(inertia): always rendering an anchor tag

This commit is contained in:
Romain Hamel
2025-05-04 16:42:24 +02:00
parent 4b3d2a7b00
commit 0d8adf782d

View File

@@ -110,14 +110,14 @@ const linkClass = computed(() => {
})
const page = usePage()
const url = computed(() => props.to ?? props.href ?? '#')
const url = computed(() => props.to ?? props.href ?? '')
const isActive = computed(() => props.active || (props.exact ? url.value === props.href : page?.url.startsWith(url.value)))
const isActive = computed(() => props.active || (!!url.value && (props.exact ? url.value === props.href : page?.url.startsWith(url.value))))
</script>
<template>
<template v-if="!isExternal">
<InertiaLink v-bind="routerLinkProps" :href="url" custom>
<template v-if="!isExternal && !!url">
<InertiaLink v-bind="routerLinkProps" :href="url">
<template v-if="custom">
<slot
v-bind="{