mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-07 13:41:23 +00:00
38 lines
610 B
Vue
38 lines
610 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"
|
|
|
|
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>
|