feat(Stepper): should limit decimal length when input (#4747)

This commit is contained in:
neverland
2019-10-16 16:37:28 +08:00
committed by GitHub
parent a65bd84e0a
commit acc972a203
2 changed files with 23 additions and 1 deletions

View File

@@ -149,7 +149,13 @@ export default createComponent({
return;
}
const formatted = this.filter(value);
let formatted = this.filter(value);
// limit max decimal length
if (isDef(this.decimalLength) && formatted.indexOf('.') !== -1) {
const pair = formatted.split('.');
formatted = `${pair[0]}.${pair[1].slice(0, this.decimalLength)}`;
}
if (!equal(value, formatted)) {
event.target.value = formatted;