File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<template >
2+ <a
3+ v-if =" isExternal"
4+ v-bind =" $attrs"
5+ :href =" to"
6+ target =" _blank"
7+ rel =" noopener noreferrer"
8+ :class =" linkClasses"
9+ >
10+ <slot ></slot >
11+ </a >
12+
213 <router-link
14+ v-else
315 v-bind =" $attrs"
416 :to =" to"
5- class =" afcl-link text-lightPrimary underline dark:text-darkPrimary hover:no-underline hover:brightness-110
6- cursor-pointer"
17+ :class =" linkClasses"
718 >
819 <slot ></slot >
920 </router-link >
1021</template >
1122
1223<script setup lang="ts">
24+ import { computed } from ' vue' ;
1325
14- defineProps <{
26+ const props = defineProps <{
1527 to: string ,
16- }>()
28+ }>();
29+
30+ const isExternal = computed (() => {
31+ return typeof props .to === ' string' && props .to .startsWith (' http' );
32+ });
33+
34+ const linkClasses = " afcl-link text-lightPrimary underline dark:text-darkPrimary hover:no-underline hover:brightness-110 cursor-pointer" ;
1735 </script >
You can’t perform that action at this time.
0 commit comments