Skip to content

Commit 958e5e4

Browse files
authored
fix: input-number ready not work #2971 (#3968)
1 parent bb56898 commit 958e5e4

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

components/input-number/index.jsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ const InputNumber = {
4848
},
4949

5050
render() {
51-
const { prefixCls: customizePrefixCls, size, ...others } = getOptionProps(this);
51+
const { prefixCls: customizePrefixCls, size, ...others } = {
52+
...getOptionProps(this),
53+
...this.$attrs,
54+
};
5255
const getPrefixCls = this.configProvider.getPrefixCls;
5356
const prefixCls = getPrefixCls('input-number', customizePrefixCls);
5457

components/vc-input-number/src/index.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const inputNumberProps = {
5555
disabled: PropTypes.bool,
5656
// onFocus: PropTypes.func,
5757
// onBlur: PropTypes.func,
58-
readOnly: PropTypes.bool,
58+
readonly: PropTypes.bool,
5959
max: PropTypes.number,
6060
min: PropTypes.number,
6161
step: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
@@ -637,7 +637,7 @@ export default {
637637
const {
638638
prefixCls,
639639
disabled,
640-
readOnly,
640+
readonly,
641641
useTouch,
642642
autoComplete,
643643
upHandler,
@@ -666,7 +666,7 @@ export default {
666666
}
667667
}
668668

669-
const editable = !this.readOnly && !this.disabled;
669+
const editable = !this.readonly && !this.disabled;
670670

671671
// focus state, show input value
672672
// unfocus state, show valid value
@@ -695,8 +695,8 @@ export default {
695695
mouseleave: this.stop,
696696
};
697697
}
698-
const isUpDisabled = !!upDisabledClass || disabled || readOnly;
699-
const isDownDisabled = !!downDisabledClass || disabled || readOnly;
698+
const isUpDisabled = !!upDisabledClass || disabled || readonly;
699+
const isDownDisabled = !!downDisabledClass || disabled || readonly;
700700
const {
701701
mouseenter = noop,
702702
mouseleave = noop,
@@ -778,7 +778,7 @@ export default {
778778
onBlur={this.onBlur}
779779
onKeydown={editable ? this.onKeyDown : noop}
780780
onKeyup={editable ? this.onKeyUp : noop}
781-
readOnly={this.readOnly}
781+
readonly={this.readonly}
782782
disabled={this.disabled}
783783
max={this.max}
784784
min={this.min}

0 commit comments

Comments
 (0)