Files
InvoiceShelf/resources/scripts/components/base/BaseText.vue
Darko Gjorgjijoski 8160b53689 Ditch global components
2025-01-12 17:53:44 +01:00

39 lines
682 B
Vue

<template>
<div class="whitespace-normal">
<BaseCustomTag :tag="tag" :title="text" class="line-clamp-1">
{{ displayText }}
</BaseCustomTag>
</div>
</template>
<script setup>
import { computed } from "vue"
import BaseCustomTag from '@/scripts/components/base/BaseCustomTag.vue'
const props = defineProps({
tag: {
type: String,
default: 'div',
},
text: {
type: String,
default: '',
},
length: {
type: Number,
default: null,
}
})
const { text, length } = props;
const displayText = computed(() => {
if (length) {
return text.length <= length ? text : `${text.substring(0, length)}...`;
}
return text;
});
</script>