Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
shichun-yu opened this issue Mar 13, 2023 · 1 comment
Open

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

shichun-yu opened this issue Mar 13, 2023 · 1 comment

Comments

@shichun-yu
Copy link

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;
}
}

@fusayyun
Copy link

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants