Tencent / tdesign-vue-next

A Vue3.x UI components lib for TDesign.
https://tdesign.tencent.com/vue-next
MIT License
1.43k stars 461 forks source link

t-input-number 设置小数位数时用户输入数据显示异常 #4499

Closed 52Hertz-1 closed 3 weeks ago

52Hertz-1 commented 1 month ago

tdesign-vue-next 版本

lastest

重现链接

官网示例中即可复现

重现步骤

decimal-places 设置为 2时,输入 6.666 输入框的值变为 6.67,如果用户一直输入小数,并且值大于 5 则值反复四舍五入

例如小明输入 6.666 , 输出为 6.67 输入 6.6666 输出为 6.68 输入 6.66666 输出为 6.69

原因: formatUnCompleteNumber 中格式化非大数的数使用的是 tofixed 导致数据四舍五入,输入框数据异常

期望结果

输入 6.666,应为 6.66,多余一位被截去而不是四舍五入

实际结果

6.67

框架版本

No response

浏览器版本

No response

系统版本

No response

Node版本

No response

补充说明

No response

github-actions[bot] commented 1 month ago

👋 @52Hertz-1,感谢给 TDesign 提出了 issue。 请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

uyarn commented 1 month ago

谢谢反馈 @52Hertz-1 我们会扩展这个API支持你的这个反馈

zhangpaopao0609 commented 3 weeks ago

将按照如下的方式来进行支持: decimalPlaces 接受 number | { enableRound: boolean, places: number } 其中 enableRound 表示是否开启四舍五入

uyarn commented 3 weeks ago

published 1.10.0