Base.tsx 1012 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
import React, { useState } from 'react';
import { Button } from 'antd';
import LoadBox from '../index';
const Demo = (props) => {
  const [spinning, setSpinning] = useState(true);
  const startClick = () => {
    setSpinning(true);
  };
  const endClick = () => {
    setSpinning(false);
  };
  return (
    <div
      style={{
        width: '100%',
        height: '100px',
        display: 'flex',
        alignContent: 'center',
        justifyContent: 'center',
        flexDirection: 'column',
      }}
    >
      <div
        style={{
          height: '100px',
          display: 'flex',
          alignContent: 'center',
          justifyContent: 'center',
        }}
      >
李纪文's avatar
李纪文 committed
31
        <LoadBox spinning={spinning} tip={'加载'} />
32 33 34 35 36 37 38 39 40 41 42 43
      </div>
      <div style={{ marginTop: '20px' }}>
        <Button onClick={startClick} style={{ marginRight: '20px' }}>
          加载
        </Button>
        <Button onClick={endClick}>取消加载</Button>
      </div>
    </div>
  );
};

export default Demo;