zdhxiong / mdui

Material Design 3(Material You) UI components using Web Components.
https://www.mdui.org
4.19k stars 365 forks source link

Incorrect Evaluation of hasValue Attribute with 0 in Text Field #332

Closed mond210 closed 4 months ago

mond210 commented 4 months ago

image

在文本字段中输入值0(数字),但由于hasValue属性为false,标签的位置不正确。这个问题可能是由于在MDUI/packages/mdui/src/components/text-field/index.ts文件的第573行使用了两次否定操作符导致的。当赋值为数字0时,进行两次否定操作会返回false。希望这个问题能够在未来得到修复。

In the text field, a value of 0 (number) is entered, but the label is not positioned correctly because the hasValue attribute is false. This issue may stem from the use of the double negation operator at line 573 in mdui/packages/mdui/src/components/text-field/index.ts. When the value is the number 0, applying the double negation results in false. It would be beneficial to have this issue corrected in the future.

zdhxiong commented 4 months ago

Fixed in v2.1.2