fix: switch tabIndex not work

pull/1143/head
tanjinzhou 2019-08-30 12:55:45 +08:00
parent c9f1c26693
commit 0a419dac6a
3 changed files with 4 additions and 3 deletions

View File

@ -18,7 +18,7 @@ const Switch = {
disabled: PropTypes.bool,
checkedChildren: PropTypes.any,
unCheckedChildren: PropTypes.any,
tabIndex: PropTypes.number,
tabIndex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
checked: PropTypes.bool,
defaultChecked: PropTypes.bool,
autoFocus: PropTypes.bool,

View File

@ -8,7 +8,7 @@ export const switchPropTypes = {
// onChange: PropTypes.func,
// onMouseUp: PropTypes.func,
// onClick: PropTypes.func,
tabIndex: PropTypes.number,
tabIndex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
checked: PropTypes.bool.def(false),
defaultChecked: PropTypes.bool.def(false),
autoFocus: PropTypes.bool.def(false),

View File

@ -79,7 +79,7 @@ export default {
},
},
render() {
const { prefixCls, disabled, loadingIcon, ...restProps } = getOptionProps(this);
const { prefixCls, disabled, loadingIcon, tabIndex, ...restProps } = getOptionProps(this);
const checked = this.stateChecked;
const switchClassName = {
[prefixCls]: true,
@ -99,6 +99,7 @@ export default {
role: 'switch',
'aria-checked': checked,
disabled,
tabIndex,
},
class: switchClassName,
ref: 'refSwitchNode',