You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
615 B
26 lines
615 B
<template>
|
|
<i18n-t tag="span" :keypath="getTitle" scope="global" />
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { type PropType, computed } from 'vue';
|
|
import { useLocaleStore } from '@/store/modules/locale';
|
|
|
|
const props = defineProps({
|
|
title: {
|
|
type: [String, Object] as PropType<string | Title18n>,
|
|
required: true,
|
|
default: '',
|
|
},
|
|
});
|
|
|
|
const localeStore = useLocaleStore();
|
|
|
|
const getTitle = computed(() => {
|
|
const { title = '' } = props;
|
|
if (typeof title === 'object') {
|
|
return title?.[localeStore.locale] ?? title;
|
|
}
|
|
return title;
|
|
});
|
|
</script>
|