From c6591fca6309a23135487c11724de1d27c84ef9e Mon Sep 17 00:00:00 2001 From: richfugui001-netizen Date: Wed, 5 Nov 2025 23:24:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcl-text=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E8=B6=85=E5=A4=A7=E5=8F=B7=E5=AD=97=E4=BD=93=E6=97=B6=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E7=9A=84=E5=A4=9A=E8=A1=8C=E9=87=8D=E5=8F=A0=E5=92=8C?= =?UTF-8?q?web=E7=AB=AF=E6=98=BE=E7=A4=BA=E4=B8=8D=E5=85=A8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cool-ui/components/cl-text/cl-text.uvue | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/uni_modules/cool-ui/components/cl-text/cl-text.uvue b/uni_modules/cool-ui/components/cl-text/cl-text.uvue index f0804cf..86f1de8 100644 --- a/uni_modules/cool-ui/components/cl-text/cl-text.uvue +++ b/uni_modules/cool-ui/components/cl-text/cl-text.uvue @@ -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;