2022-05-11 14:48:04 +02:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<div v-if="isExternal">
|
|
|
|
<a :href="to">
|
|
|
|
<span
|
|
|
|
:class="`fa fa-lg fa-fw ${fa}`"
|
|
|
|
aria-hidden="true"
|
|
|
|
/>
|
|
|
|
|
|
|
|
<slot/>
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<span
|
|
|
|
class="fa fa-lg fa-fw fa-external-link"
|
|
|
|
aria-hidden="true"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<router-link
|
|
|
|
v-else
|
2022-05-23 16:25:55 +02:00
|
|
|
:to="{ name: props.to }"
|
2022-05-11 14:48:04 +02:00
|
|
|
>
|
|
|
|
<span
|
|
|
|
:class="`fa fa-lg fa-fw ${fa}`"
|
|
|
|
aria-hidden="true"
|
|
|
|
/>
|
|
|
|
|
|
|
|
<slot/>
|
|
|
|
</router-link>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-05-23 16:25:55 +02:00
|
|
|
<script setup>
|
|
|
|
import { computed } from 'vue'
|
2022-05-11 14:48:04 +02:00
|
|
|
import { RouterLink } from 'vue-router'
|
|
|
|
|
2022-05-23 16:25:55 +02:00
|
|
|
const props = defineProps({
|
|
|
|
to: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
2022-05-11 14:48:04 +02:00
|
|
|
},
|
2022-05-23 16:25:55 +02:00
|
|
|
fa: {
|
|
|
|
type: String,
|
|
|
|
default: ''
|
2022-05-11 14:48:04 +02:00
|
|
|
}
|
2022-05-23 16:25:55 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
const isExternal = computed(() => props.to.startsWith('http'))
|
2022-05-11 14:48:04 +02:00
|
|
|
</script>
|