mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 02:59:58 +08:00
fix #12539. delay also double confirm spin status.
This commit is contained in:
parent
00d1a26d4e
commit
f9c2310424
@ -96,7 +96,7 @@ class Spin extends React.Component<SpinProps, SpinState> {
|
||||
componentDidMount() {
|
||||
const { spinning, delay } = this.props;
|
||||
if (shouldDelay(spinning, delay)) {
|
||||
this.delayTimeout = window.setTimeout(() => this.setState({ spinning }), delay);
|
||||
this.delayTimeout = window.setTimeout(this.delayUpdateSpinning, delay);
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,17 +126,24 @@ class Spin extends React.Component<SpinProps, SpinState> {
|
||||
clearTimeout(this.delayTimeout);
|
||||
}
|
||||
} else {
|
||||
if (spinning && delay && !isNaN(Number(delay))) {
|
||||
if (shouldDelay(spinning, delay)) {
|
||||
if (this.delayTimeout) {
|
||||
clearTimeout(this.delayTimeout);
|
||||
}
|
||||
this.delayTimeout = window.setTimeout(() => this.setState({ spinning }), delay);
|
||||
this.delayTimeout = window.setTimeout(this.delayUpdateSpinning, delay);
|
||||
} else {
|
||||
this.setState({ spinning });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delayUpdateSpinning = () => {
|
||||
const { spinning } = this.props;
|
||||
if (this.state.spinning !== spinning) {
|
||||
this.setState({ spinning });
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const { className, size, prefixCls, tip, wrapperClassName, ...restProps } = this.props;
|
||||
const { spinning } = this.state;
|
||||
|
Loading…
Reference in New Issue
Block a user