ElemeFE / element

A Vue.js 2.0 UI Toolkit for Web
https://element.eleme.io/
MIT License
54.13k stars 14.64k forks source link

[Bug Report] 【el-input】textarea input exceeded the limit #22904

Open WangYJEE opened 5 months ago

WangYJEE commented 5 months ago

Element UI version

2.15.14

OS/Browsers version

Chrome

Vue version

2.7.16

Reproduction Link

https://codepen.io/pen?&prefill_data_id=20b168f4-c0ab-4736-9ce0-4ff71f13ea05

Steps to reproduce

官网文档可复现,el-input设置textarea,输入限制30,在输入29字符后,回车再删除,这时可以输入超出限制的符号,如中文句号

What is Expected?

输入限制生效,超出限制时不能输入

What is actually happening?

超出限制时依然能输入中文句号

https://github.com/ElemeFE/element/assets/40554198/e3919d76-8a8d-4a70-8dd9-c6de053880a6

wangdaodao commented 4 months ago

测试了下,是 chrome 浏览器(126.0.6478.127)的问题,火狐下不会出现此问题。

使用原生 textarea 配合 maxlength,根据描述即可复现出此问题。

图片

https://blog.kainy.cn/2012/09/in-chromes-fulfilled-textareathe-value-of-maxlength-doesnt-match-with-value-length/