From b53f77b304a520e925af9d4a752e0f2933cfb71d Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Wed, 26 Feb 2025 15:57:35 +0100 Subject: [PATCH] fix(Link): improve external links handling in vue --- src/runtime/vue/components/Link.vue | 26 +++------ .../CommandPalette-vue.spec.ts.snap | 44 +++++++------- .../ContextMenu-vue.spec.ts.snap | 34 +++++------ .../DropdownMenu-vue.spec.ts.snap | 38 ++++++------ .../NavigationMenu-vue.spec.ts.snap | 58 +++++++++---------- 5 files changed, 96 insertions(+), 104 deletions(-) diff --git a/src/runtime/vue/components/Link.vue b/src/runtime/vue/components/Link.vue index 21181709..3c91bf7a 100644 --- a/src/runtime/vue/components/Link.vue +++ b/src/runtime/vue/components/Link.vue @@ -182,7 +182,7 @@ function isLinkActive({ route: linkRoute, isActive, isExactActive }: any) { return false } -function resolveLinkClass({ route, isActive, isExactActive }: any) { +function resolveLinkClass({ route, isActive, isExactActive }: any = {}) { const active = isLinkActive({ route, isActive, isExactActive }) if (props.raw) { @@ -191,19 +191,10 @@ function resolveLinkClass({ route, isActive, isExactActive }: any) { return ui.value({ class: props.class, active, disabled: props.disabled }) } - -// Handle navigation without vue-router -const handleNavigation = (href: string) => { - if (isExternal.value) { - window.location.href = href - } else { - window.location.pathname = href - } -}