2019-01-09 20:38:09 +08:00
|
|
|
---
|
|
|
|
order: 3
|
|
|
|
title:
|
|
|
|
zh-CN: 倒计时
|
|
|
|
en-US: Countdown
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
倒计时组件。
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
Countdown component.
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
import { Statistic, Row, Col } from 'antd';
|
|
|
|
|
|
|
|
const Countdown = Statistic.Countdown;
|
|
|
|
const deadline = Date.now() + 1000 * 60 * 60 * 24 * 2 + 1000 * 30; // Moment is also OK
|
|
|
|
|
2019-02-12 17:16:49 +08:00
|
|
|
function onFinish() {
|
|
|
|
console.log('finished!');
|
|
|
|
}
|
|
|
|
|
2019-01-09 20:38:09 +08:00
|
|
|
ReactDOM.render(
|
|
|
|
<Row gutter={16}>
|
|
|
|
<Col span={12}>
|
2019-02-12 17:16:49 +08:00
|
|
|
<Countdown title="Countdown" value={deadline} onFinish={onFinish} />
|
2019-01-09 20:38:09 +08:00
|
|
|
</Col>
|
|
|
|
<Col span={12}>
|
|
|
|
<Countdown title="Million Seconds" value={deadline} format="HH:mm:ss:SSS" />
|
|
|
|
</Col>
|
|
|
|
<Col span={24} style={{ marginTop: 32 }}>
|
|
|
|
<Countdown title="Day Level" value={deadline} format="D 天 H 时 m 分 s 秒" />
|
|
|
|
</Col>
|
|
|
|
</Row>,
|
2019-05-07 14:57:32 +08:00
|
|
|
mountNode,
|
2019-01-09 20:38:09 +08:00
|
|
|
);
|
|
|
|
```
|