fix(Link): handle aria-current like NuxtLink / RouterLink

This commit is contained in:
Benjamin Canac
2025-03-24 23:57:46 +01:00
parent d73768b704
commit c531d0248b
2 changed files with 6 additions and 0 deletions

View File

@@ -102,6 +102,7 @@ defineOptions({ inheritAttrs: false })
const props = withDefaults(defineProps<LinkProps>(), {
as: 'button',
type: 'button',
ariaCurrentValue: 'page',
active: undefined,
activeClass: '',
inactiveClass: ''
@@ -178,6 +179,7 @@ function resolveLinkClass({ route, isActive, isExactActive }: any) {
<slot
v-bind="{
...$attrs,
...(exact && isExactActive ? { 'aria-current': props.ariaCurrentValue } : {}),
as,
type,
disabled,
@@ -194,6 +196,7 @@ function resolveLinkClass({ route, isActive, isExactActive }: any) {
v-else
v-bind="{
...$attrs,
...(exact && isExactActive ? { 'aria-current': props.ariaCurrentValue } : {}),
as,
type,
disabled,

View File

@@ -103,6 +103,7 @@ defineOptions({ inheritAttrs: false })
const props = withDefaults(defineProps<LinkProps>(), {
as: 'button',
type: 'button',
ariaCurrentValue: 'page',
active: undefined,
activeClass: '',
inactiveClass: ''
@@ -204,6 +205,7 @@ function resolveLinkClass({ route, isActive, isExactActive }: any = {}) {
<slot
v-bind="{
...$attrs,
...(exact && isExactActive ? { 'aria-current': props.ariaCurrentValue } : {}),
as,
type,
disabled,
@@ -217,6 +219,7 @@ function resolveLinkClass({ route, isActive, isExactActive }: any = {}) {
v-else
v-bind="{
...$attrs,
...(exact && isExactActive ? { 'aria-current': props.ariaCurrentValue } : {}),
as,
type,
disabled,