This commit is contained in:
ztplz 2019-02-24 15:49:12 +08:00 committed by zombieJ
parent cca47ac3be
commit 94814d955f

View File

@ -24,15 +24,18 @@ export default class ActionButton extends React.Component<ActionButtonProps, Act
loading: false,
};
}
componentDidMount() {
if (this.props.autoFocus) {
const $this = ReactDOM.findDOMNode(this) as HTMLInputElement;
this.timeoutId = setTimeout(() => $this.focus());
}
}
componentWillUnmount() {
clearTimeout(this.timeoutId);
}
onClick = () => {
const { actionFn, closeModal } = this.props;
if (actionFn) {