ViewUIPlus icon indicating copy to clipboard operation
ViewUIPlus copied to clipboard

[Bug Report]InputNumber precision不能直接使用toFixed

Open shichun-yu opened this issue 2 years ago • 1 comments

Environment

vue3.2.33

Reproduction link

https://www.iviewui.com/view-ui-plus/component/form/input-number

Steps to reproduce

设置precision = 2

What is expected?

期待失去焦点触发toFixed,而不是computed

What is actually happening?

假如我想输入2.22 当我输入2时 我的value会立刻变成2.00 这时候我需要backspace


InputNumber源码: precisionValue () { // can not display 1.0 if(!this.currentValue) return this.currentValue; return this.precision ? this.currentValue.toFixed(this.precision) : this.currentValue; }, formatterValue () { if (this.formatter && this.precisionValue !== null) { return this.formatter(this.precisionValue); } else { return this.precisionValue; } }

shichun-yu avatar Mar 13 '23 03:03 shichun-yu

You can set active-change="false" to fix this problem <InputNumber v-model="value" :min="1" :max="9999999999" style="width:100%;" :precision="2" :step="0.01" :active-change="false" > </InputNumber>

fusayyun avatar Sep 12 '23 01:09 fusayyun