mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-08-05 03:57:03 -04:00
29 lines
655 B
Vue
29 lines
655 B
Vue
<script setup lang="ts">
|
|
import { getUrlForLocale } from '~/src/domain.ts';
|
|
|
|
const props = defineProps<{
|
|
link: string;
|
|
locale?: string;
|
|
}>();
|
|
|
|
const config = useConfig();
|
|
|
|
const isExternal = computed(() => !props.link.startsWith('/'));
|
|
|
|
const to = computed(() => {
|
|
if (isExternal.value) {
|
|
return props.link;
|
|
}
|
|
if (props.locale !== undefined && props.locale !== config.locale) {
|
|
return getUrlForLocale(props.locale) + props.link;
|
|
}
|
|
return props.link;
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<NuxtLink :to :no-rel="!isExternal" :target="isExternal ? '_blank' : undefined">
|
|
<slot></slot>
|
|
</NuxtLink>
|
|
</template>
|