From 60f2fe61ae77e170e2c05e1b20d256ab107ee4db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=A9=AC?= Date: Tue, 6 May 2025 11:03:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=20Text?= =?UTF-8?q?area=20=E8=AE=BE=E7=BD=AE=E4=B8=BA=20null=20=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=AD=97=E6=95=B0=E9=99=90=E5=88=B6=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98=20(#1004)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✅ Closes: #1003 --- .../wot-design-uni/components/wd-textarea/wd-textarea.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uni_modules/wot-design-uni/components/wd-textarea/wd-textarea.vue b/src/uni_modules/wot-design-uni/components/wd-textarea/wd-textarea.vue index 57fbf6cd..0a04af38 100644 --- a/src/uni_modules/wot-design-uni/components/wd-textarea/wd-textarea.vue +++ b/src/uni_modules/wot-design-uni/components/wd-textarea/wd-textarea.vue @@ -181,7 +181,7 @@ const currentLength = computed(() => { * 使用Array.from处理多码元字符以获取正确的长度 * @link https://github.com/Moonofweisheng/wot-design-uni/issues/933 */ - return Array.from(String(formatValue(props.modelValue) || '')).length + return Array.from(String(formatValue(props.modelValue))).length }) const rootClass = computed(() => { @@ -224,6 +224,7 @@ function initState() { } function formatValue(value: string | number) { + if (value === null || value === undefined) return '' const { maxlength, showWordLimit } = props if (showWordLimit && maxlength !== -1 && String(value).length > maxlength) { return value.toString().substring(0, maxlength)