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 =" target"
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+ :target = " target "
18+ :class = " linkClasses "
719 >
820 <slot ></slot >
921 </router-link >
1022</template >
1123
1224<script setup lang="ts">
25+ import { computed } from ' vue' ;
1326
14- defineProps <{
27+ const props = defineProps <{
1528 to: string ,
16- }>()
29+ target? : ' blank' | ' self' | ' parent' | ' top'
30+ }>();
31+
32+ const isExternal = computed (() => {
33+ return typeof props .to === ' string' && props .to .startsWith (' http' );
34+ });
35+
36+ const linkClasses = " afcl-link text-lightPrimary underline dark:text-darkPrimary hover:no-underline hover:brightness-110 cursor-pointer" ;
1737 </script >
You can’t perform that action at this time.
0 commit comments