fix(Link): handle disabled prop

Fixes #473
This commit is contained in:
Benjamin Canac
2023-08-01 12:32:11 +02:00
parent dc1979cae1
commit 396aae7563

View File

@@ -1,5 +1,5 @@
<template>
<button v-if="!to" v-bind="$attrs" :class="inactiveClass">
<button v-if="!to" :type="type" :disabled="disabled" v-bind="$attrs" :class="inactiveClass">
<slot />
</button>
<NuxtLink
@@ -10,7 +10,9 @@
>
<a
v-bind="$attrs"
:href="href"
:href="!disabled ? href : undefined"
:aria-disabled="disabled ? 'true' : undefined"
:role="disabled ? 'link' : undefined"
:rel="rel"
:target="target"
:class="resolveLinkClass(route, { isActive, isExactActive })"
@@ -31,6 +33,14 @@ export default defineComponent({
inheritAttrs: false,
props: {
...NuxtLink.props,
type: {
type: String,
default: null
},
disabled: {
type: Boolean,
default: null
},
exact: {
type: Boolean,
default: false