mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 11:08:45 +08:00
feat: debounce before spinning => debounce after spinning (#2486)
This commit is contained in:
parent
ca57794ae7
commit
ac32dd5811
@ -52,12 +52,13 @@ export default class Spin extends React.Component {
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const currentSpinning = this.getSpinning(this.props);
|
||||
const spinning = this.getSpinning(nextProps);
|
||||
if (this.debounceTimeout) {
|
||||
clearTimeout(this.debounceTimeout);
|
||||
}
|
||||
if (spinning) {
|
||||
this.debounceTimeout = setTimeout(() => this.setState({ spinning }), 250);
|
||||
if (currentSpinning && !spinning) {
|
||||
this.debounceTimeout = setTimeout(() => this.setState({ spinning }), 500);
|
||||
} else {
|
||||
this.setState({ spinning });
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user