SpinContainer.jsx 900 B

1234567891011121314151617181920212223242526272829303132
  1. import React,{Component} from 'react';
  2. import {Spin} from "antd";
  3. class SpinContainer extends Component{
  4. constructor(props) {
  5. super(props);
  6. }
  7. render() {
  8. return (
  9. <div style={{position:'relative'}}>
  10. {this.props.children}
  11. {this.props.spinning ? <div style={{
  12. position: 'absolute',
  13. top: '0px',
  14. bottom: '0px',
  15. left: '0px',
  16. right: '0px',
  17. display: 'flex',
  18. alignItems: 'center',
  19. justifyContent: 'center',
  20. background: 'rgb(255, 255, 255,.3)',
  21. }}>
  22. <Spin className={this.props.className} spinning={this.props.spinning}/>
  23. </div> : null}
  24. </div>
  25. )
  26. }
  27. }
  28. export default SpinContainer;