Skip to content

Commit

Permalink
fix(LinkCustom): exact prop wasn't working
Browse files Browse the repository at this point in the history
Resolves #417
  • Loading branch information
benjamincanac committed Jul 19, 2023
1 parent 403899f commit 82e152b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/runtime/components/elements/LinkCustom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</button>
<NuxtLink
v-else
v-slot="{ href, target, rel, navigate, exact, isActive, isExactActive, isExternal }"
v-slot="{ href, target, rel, navigate, isActive, isExactActive, isExternal }"
v-bind="$props"
custom
>
Expand All @@ -29,14 +29,22 @@ export default defineComponent({
inheritAttrs: false,
props: {
...NuxtLink.props,
exact: {
type: Boolean,
default: false
},
inactiveClass: {
type: String,
default: undefined
}
},
setup (props) {
function resolveLinkClass ({ isActive, isExactActive }: { isActive: boolean, isExactActive: boolean }) {
if (isActive || isExactActive) {
if (props.exact && isExactActive) {
return props.activeClass
}
if (!props.exact && isActive) {
return props.activeClass
}
Expand Down

1 comment on commit 82e152b

@vercel
Copy link

@vercel vercel bot commented on 82e152b Jul 19, 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.nuxtlabs.com
ui-git-dev-nuxtlabs.vercel.app

Please sign in to comment.