PronounsPage/components/PotentiallyExternalLink.vue
Andrea Vos cabda5bec8 (lint)
2024-05-15 21:23:33 +02:00

20 lines
426 B
Vue

<template>
<a v-if="isExternal" :href="to" target="_blank" rel="noopener"><slot></slot></a>
<nuxt-link v-else :to="to">
<slot></slot>
</nuxt-link>
</template>
<script>
export default {
props: {
to: { required: true, type: String },
},
computed: {
isExternal() {
return this.to.startsWith('https://') || this.to.startsWith('http://');
},
},
};
</script>