Files
TaskPool/web/src/components/TextOverflow.vue
T

40 lines
945 B
Vue
Raw Normal View History

2025-12-24 10:48:23 +08:00
<script setup lang="ts">
import { ref } from 'vue'
2026-04-08 21:47:30 +08:00
import BaihuDialog from '@/components/ui/BaihuDialog.vue'
2025-12-24 10:48:23 +08:00
const props = withDefaults(
defineProps<{
text: string
title?: string
}>(),
{
title: '详情'
}
)
const showDialog = ref(false)
function handleClick() {
if (props.text && props.text !== '-') {
showDialog.value = true
}
}
</script>
<template>
2026-04-30 09:01:02 +08:00
<span v-bind="$attrs" class="truncate block cursor-pointer hover:text-primary transition-colors" :title="text || '-'"
2026-04-08 21:47:30 +08:00
@click.stop="handleClick">
2025-12-24 10:48:23 +08:00
{{ text || '-' }}
</span>
2026-04-08 21:47:30 +08:00
<BaihuDialog v-model:open="showDialog" :title="title">
<div class="max-h-[60vh] overflow-y-auto custom-scrollbar">
2026-04-20 20:42:17 +08:00
<div class="p-4 bg-muted/30 rounded-xl border border-border/50">
2026-04-30 09:01:02 +08:00
<p class="text-[13.5px] leading-relaxed text-foreground/90 break-all whitespace-pre-wrap">
2026-04-20 20:42:17 +08:00
{{ text }}
</p>
</div>
2026-04-08 21:47:30 +08:00
</div>
</BaihuDialog>
2025-12-24 10:48:23 +08:00
</template>