[Bug Report]InputNumber precision不能直接使用toFixed
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; } }
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>