Merge pull request #8 from YarenTang/fix_input_number

输入框体验更人性化
This commit is contained in:
yison 2019-06-28 16:30:54 +08:00 committed by GitHub
commit 29bc2be495
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -186,8 +186,13 @@
}, },
precisionValue () { precisionValue () {
// can not display 1.0 // can not display 1.0
if(!this.currentValue) return this.currentValue; // if(!this.currentValue) return this.currentValue;
return this.precision ? this.currentValue.toFixed(this.precision) : this.currentValue; // return this.precision ? this.currentValue.toFixed(this.precision) : this.currentValue;
let arr = (this.currentValue + '').split('.');
if (this.precision && arr[1] && this.precision < arr[1].length) {
return this.currentValue.toFixed(this.precision);
}
return this.currentValue;
}, },
formatterValue () { formatterValue () {
if (this.formatter && this.precisionValue !== null) { if (this.formatter && this.precisionValue !== null) {