统一甲屿云命名体系
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
<template>
|
||||
<span v-if="!displayText" class="empty-text">{{ emptyText }}</span>
|
||||
<a-tooltip v-else :title="displayText" placement="topLeft">
|
||||
<div class="ellipsis-text" :class="lineClass">
|
||||
{{ displayText }}
|
||||
</div>
|
||||
</a-tooltip>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* TableEllipsisText page script.
|
||||
* Call guide: the template binds the reactive state below, and the methods are triggered by button clicks, lifecycle hooks, or router events.
|
||||
*/
|
||||
import { computed } from 'vue'
|
||||
|
||||
/**
|
||||
* Purpose: props supports TableEllipsisText.vue by holding or executing the props page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const props = withDefaults(defineProps<{
|
||||
text?: string | number | null
|
||||
lines?: 1 | 2 | 3
|
||||
emptyText?: string
|
||||
}>(), {
|
||||
lines: 1,
|
||||
emptyText: '--'
|
||||
})
|
||||
|
||||
/** displayText is a reactive state variable used by the template and event handlers. */
|
||||
const displayText = computed(() => {
|
||||
if (props.text === undefined || props.text === null) {
|
||||
return ''
|
||||
}
|
||||
const value = String(props.text).trim()
|
||||
return value
|
||||
})
|
||||
|
||||
/** lineClass is a reactive state variable used by the template and event handlers. */
|
||||
const lineClass = computed(() => {
|
||||
return props.lines > 1 ? `lines-${props.lines}` : ''
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ellipsis-text {
|
||||
display: inline-block;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
line-height: 1.5;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.lines-2,
|
||||
.lines-3 {
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
white-space: normal;
|
||||
word-break: normal;
|
||||
overflow-wrap: normal;
|
||||
}
|
||||
|
||||
.lines-2 {
|
||||
-webkit-line-clamp: 2;
|
||||
}
|
||||
|
||||
.lines-3 {
|
||||
-webkit-line-clamp: 3;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user