From a2166f85930cb020a5f1d0ec48b1dd95c5980732 Mon Sep 17 00:00:00 2001 From: William Chong Date: Thu, 19 Oct 2023 18:41:02 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8D=EF=B8=8F=20Do=20no=20overwrite=20h?= =?UTF-8?q?ref=20in=20NuxtLink=20with=20null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Link.vue | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/components/Link.vue b/components/Link.vue index 077968bf..7c5380f1 100644 --- a/components/Link.vue +++ b/components/Link.vue @@ -2,10 +2,7 @@ @@ -22,16 +19,25 @@ export default class Link extends Vue { @Prop(String) readonly href: string | undefined @Prop({ default: false }) readonly isInline!: boolean + get attrs() { + if (this.to) { + return { to: this.to } + } + if (this.href) { + return { + href: this.href, + target: '_blank', + rel: 'noopener noreferrer', + } + } + return {} + } + get tag() { if (this.to) return 'NuxtLink' return 'a' } - get rel() { - if (this.href) return 'noopener noreferrer' - return null - } - get rootClasses() { return [ this.isInline ? 'inline-flex' : 'flex',