Skip to content

Commit b4cd392

Browse files
weinanyangweinanyang
weinanyang
authored and
weinanyang
committed
chore(*): update, close #3768
1 parent d7b7d4a commit b4cd392

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/number-picker/number-picker.jsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -427,23 +427,23 @@ class NumberPicker extends React.Component {
427427
return onDisabled(e);
428428
}
429429

430-
const value = this.state.value;
430+
let value = this.state.value;
431431
// 受控下,可能强制回填非法值
432432
if (isNaN(value)) {
433433
return;
434434
}
435435

436+
if (value === '' && !this.props.stringMode) {
437+
value = 0;
438+
}
439+
436440
let val = this[`${type}Step`](value);
437441
val = this.correctBoundary(val);
438442
// 受控下,显示的值应为受控value
439443
if (!('value' in this.props)) {
440444
this.setDisplayValue({ displayValue: val });
441445
}
442446

443-
if (!this.props.stringMode) {
444-
val = Number(val);
445-
}
446-
447447
this.setValue({ value: val, e, triggerType: type });
448448
}
449449

0 commit comments

Comments
 (0)