mock平台

Loading.js 823B

12345678910111213141516171819202122232425262728293031323334353637
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. import './Loading.scss';
  4. export default class Loading extends React.PureComponent {
  5. static defaultProps = {
  6. visible: false
  7. };
  8. static propTypes = {
  9. visible: PropTypes.bool
  10. };
  11. constructor(props) {
  12. super(props);
  13. this.state = { show: props.visible };
  14. }
  15. componentWillReceiveProps(nextProps) {
  16. this.setState({ show: nextProps.visible });
  17. }
  18. render() {
  19. return (
  20. <div className="loading-box" style={{ display: this.state.show ? 'flex' : 'none' }}>
  21. <div className="loading-box-bg" />
  22. <div className="loading-box-inner">
  23. <div />
  24. <div />
  25. <div />
  26. <div />
  27. <div />
  28. <div />
  29. <div />
  30. <div />
  31. </div>
  32. </div>
  33. );
  34. }
  35. }