From a10a30ff60cb7708f9884aa12102e887db0ce28f Mon Sep 17 00:00:00 2001 From: zombiej Date: Sat, 26 Dec 2020 23:59:36 +0800 Subject: [PATCH] fix: miss merge logic --- components/input/TextArea.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/input/TextArea.tsx b/components/input/TextArea.tsx index 6172665e8c..9ef0b034e8 100644 --- a/components/input/TextArea.tsx +++ b/components/input/TextArea.tsx @@ -96,10 +96,12 @@ const TextArea = React.forwardRef( /> ); - const val = fixControlledValue(value) as string; + let val = fixControlledValue(value) as string; // Max length value const hasMaxLength = Number(maxLength) > 0; + // fix #27612 将value转为数组进行截取,解决 '😂'.length === 2 等emoji表情导致的截取乱码的问题 + val = hasMaxLength ? [...val].slice(0, maxLength).join('') : val; // TextArea const textareaNode = (