40 lines
698 B
Vue
40 lines
698 B
Vue
<script setup lang="ts">
|
|
import type { ClassType } from '#layers/types/Common'
|
|
|
|
interface Props {
|
|
to: string
|
|
target?: string
|
|
class?: ClassType
|
|
}
|
|
|
|
const props = withDefaults(defineProps<Props>(), {
|
|
target: '',
|
|
class: '',
|
|
})
|
|
|
|
const componentTag = computed(() => {
|
|
return props.target === '_blank' ? 'a' : 'AtomsLocaleLink'
|
|
})
|
|
|
|
const componentProps = computed(() => {
|
|
if (props.target === '_blank') {
|
|
return {
|
|
href: props.to,
|
|
target: props.target,
|
|
class: props.class,
|
|
}
|
|
}
|
|
|
|
return {
|
|
to: props.to,
|
|
class: props.class,
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<component :is="componentTag" v-bind="{ ...componentProps }">
|
|
<slot />
|
|
</component>
|
|
</template>
|