From d68df7f6b411b8a820f69a863ca1d08df933c5dc Mon Sep 17 00:00:00 2001 From: weinanyang <90443688+weinianyang@users.noreply.github.com> Date: Tue, 1 Mar 2022 12:01:34 +0800 Subject: [PATCH] fix(NumberPicker): repair numberPicker log string, close #3768 (#3769) --- src/number-picker/number-picker.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/number-picker/number-picker.jsx b/src/number-picker/number-picker.jsx index 035dad176f..c33491fd48 100644 --- a/src/number-picker/number-picker.jsx +++ b/src/number-picker/number-picker.jsx @@ -427,12 +427,16 @@ class NumberPicker extends React.Component { return onDisabled(e); } - const value = this.state.value; + let value = this.state.value; // 受控下,可能强制回填非法值 if (isNaN(value)) { return; } + if (value === '' && !this.props.stringMode) { + value = 0; + } + let val = this[`${type}Step`](value); val = this.correctBoundary(val); // 受控下,显示的值应为受控value