Merge pull request #60 from richfugui001-netizen/patch-1

修复cl-text设置超大号字体时导致的多行重叠和web端显示不全的问题
This commit is contained in:
COOL
2025-11-06 16:15:23 +08:00
committed by GitHub

View File

@@ -209,9 +209,17 @@ const textStyle = computed(() => {
}
// 行高
const lineHeight = getLineHeight();
if (lineHeight != null) {
style["lineHeight"] = lineHeight;
// 判断是否多行文本
const isMultiLine = props.preWrap || !props.ellipsis || props.lines > 1;
if (isMultiLine) {
// 多行文本,行高交给浏览器/平台自动计算
style["lineHeight"] = "normal";
} else {
// 单行文本,使用原来的行高逻辑
const lineHeight = getLineHeight();
if (lineHeight != null) {
style["lineHeight"] = lineHeight;
}
}
return style;