view-design / ViewUIPlus

An enterprise-level UI component library and front-end solution based on Vue.js 3
https://www.iviewui.com
Other
368 stars 123 forks source link

[Feature Request]希望为 InputNumber 增加属性 integer 来限制输入是否仅为整数 #347

Open GodExious opened 6 months ago

GodExious commented 6 months ago

What problem does this feature solve?

限制输入可以仅为整数,其实只要在组件的验证环节加一点点修改应该就可以了,这个功能还是比较实用的,很多时候输入不需要浮点数,比如RGB颜色分量的输入就是0~255之间的整数

What does the proposed API look like?

我期望的部分是对 InputNumber 组件的属性增加和内部优化,在使用时<InputNumber :interger="true" />即可生效的使用方式

GodExious commented 6 months ago

好像可以通过设置precision = 0实现

GodExious commented 6 months ago

好像可以通过设置precision = 0实现

但是会进行四舍五入,而不是Floor,所以可能还是希望有一个 InputNumber 的 integer 属性验证功能吧

或者可能最简单的对组件的改法是对precision取舍模式的修改,提供 round、floor、ceil 等多种模式