ant-design/components/spin/demo/custom-indicator.md
kossel 92aa34c1b5 Feature antd 3.0/spinning indicator (#7977)
* Added indicator props to Spin component

* Added indicator props to Spin component

* update snapshots

* fix defautl props

* revert some snapshot files
2017-11-04 12:05:25 +08:00

1.4 KiB

order title
0
zh-CN en-US
自定义指示符 Custom spinning indicator

zh-CN

使用自定义指示符。

en-US

Use custom loading indicator.

import { Spin, Icon } from 'antd';

const antIcon = <Icon type="loading-3-quarters" style={{ fontSize: 24 }} spin />;
const squareLoader = <div className="square-loader" />;

ReactDOM.render(
  <div>
    <Spin indicator={antIcon} />
    <Spin indicator={squareLoader} />
  </div>, mountNode);
.square-loader {
  width: 24px;
  height: 24px;
  background-color: #108ee9;
  -webkit-animation: sk-rotateplane 1.2s infinite ease-in-out;
  animation: sk-rotateplane 1.2s infinite ease-in-out;
}

@-webkit-keyframes sk-rotateplane {
  0% { -webkit-transform: perspective(120px) }
  50% { -webkit-transform: perspective(120px) rotateY(180deg) }
  100% { -webkit-transform: perspective(120px) rotateY(180deg)  rotateX(180deg) }
}

@keyframes sk-rotateplane {
  0% {
    transform: perspective(120px) rotateX(0deg) rotateY(0deg);
    -webkit-transform: perspective(120px) rotateX(0deg) rotateY(0deg)
  } 50% {
    transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg);
    -webkit-transform: perspective(120px) rotateX(-180.1deg) rotateY(0deg)
  } 100% {
    transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);
    -webkit-transform: perspective(120px) rotateX(-180deg) rotateY(-179.9deg);
  }
}