cl-text 支持多行省略号

This commit is contained in:
icssoa
2025-09-08 15:44:52 +08:00
parent cfbff041d2
commit 126bb65168
2 changed files with 34 additions and 12 deletions

View File

@@ -114,6 +114,11 @@ const props = defineProps({
type: Boolean,
default: false
},
// 最大行数
lines: {
type: Number,
default: 1
},
// 是否可选择
selectable: {
type: Boolean,
@@ -185,7 +190,9 @@ const isDefaultSize = computed(() => !hasTextSize(pt.value.className ?? ""));
// 文本样式
const textStyle = computed(() => {
const style = {};
const style = {
lines: props.lines
};
// 判断是不是有颜色样式
if (!hasTextColor(ptClassName.value)) {
@@ -320,7 +327,16 @@ const content = computed(() => {
}
&--ellipsis {
@apply truncate w-full;
text-overflow: ellipsis;
// #ifndef APP
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
-webkit-line-clamp: v-bind(lines);
line-break: anywhere;
-webkit-box-orient: vertical;
// #endif
}
&--default-size {