49 lines
739 B
Vue
49 lines
739 B
Vue
<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
|
|
:to="{ name: props.to }"
|
|
>
|
|
<span
|
|
:class="`fa fa-lg fa-fw ${fa}`"
|
|
aria-hidden="true"
|
|
/>
|
|
|
|
<slot/>
|
|
</router-link>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { computed } from 'vue'
|
|
import { RouterLink } from 'vue-router'
|
|
|
|
const props = defineProps({
|
|
to: {
|
|
type: String,
|
|
required: true
|
|
},
|
|
fa: {
|
|
type: String,
|
|
default: ''
|
|
}
|
|
})
|
|
|
|
const isExternal = computed(() => props.to.startsWith('http'))
|
|
</script>
|