Skip to content

Commit

Permalink
fix(Link): handle disabled prop
Browse files Browse the repository at this point in the history
Fixes #473
  • Loading branch information
benjamincanac committed Aug 1, 2023
1 parent dc1979c commit 396aae7
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/runtime/components/elements/Link.vue
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 })"
Expand All @@ -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
Expand Down

1 comment on commit 396aae7

@vercel
Copy link

@vercel vercel bot commented on 396aae7 Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ui – ./

ui-nuxtlabs.vercel.app
ui-git-dev-nuxtlabs.vercel.app
ui.nuxtlabs.com

Please sign in to comment.