-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce993fd
commit cf0ecf8
Showing
12 changed files
with
615 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from 'react'; | ||
import { Countdown } from '../src'; | ||
import './index.less'; | ||
|
||
function CountdownDemo() { | ||
return ( | ||
<div> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<br /> | ||
<div style={{ marginBottom: '10px' }}> | ||
<h6>默认格式:时 : 分 : 秒</h6> | ||
<Countdown seconds={10000} /> | ||
<h6>显示天数</h6> | ||
<Countdown isShowDay seconds={10000} /> | ||
</div> | ||
<div style={{ marginBottom: '10px' }}> | ||
<h6>自定义格式: 天 : hh : mm : ss</h6> | ||
<Countdown | ||
isShowHour | ||
format={{ day: '天', hours: ':', minutes: ':', seconds: '' }} | ||
seconds={10000} | ||
/> | ||
</div> | ||
<div style={{ marginBottom: '10px' }}> | ||
<h6> 倒计时时间到,执行的回调函数</h6> | ||
<Countdown | ||
isShowHour | ||
format={{ day: '天', hours: ':', minutes: ':', seconds: '' }} | ||
seconds={20} | ||
onTimeUp={() => { | ||
console.log('biu~'); | ||
}} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} | ||
export default CountdownDemo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,7 @@ | |
border-radius: 10px; | ||
} | ||
} | ||
* { | ||
margin: 0; | ||
padding: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
title: Countdown 倒计时 | ||
--- | ||
|
||
## Countdown 倒计时 | ||
|
||
倒计时组件 | ||
|
||
- 支持自定义格式 | ||
- 支持 天 时 分 秒 | ||
|
||
<code src="../../demo/Countdown"></code> | ||
|
||
| 参数 | 说明 | 类型 | 可选值 | 默认值 | | ||
| ---------- | -------------- | ------- | ------ | ------------------------------------------------ | | ||
| isShowDay | 是否显示天数 | Boolean | - | false | | ||
| isShowHour | 是否显示小时 | Boolean | - | true | | ||
| format | 格式化分割符号 | Object | - | day: '天',hours: '时',minutes: '分 seconds : '秒 | | ||
| day | 天数 | Number | - | 0 | | ||
| hours | 小时 | Number | - | 0 | | ||
| minutes | 分钟 | Number | - | 0 | | ||
| seconds | 秒 | Number | - | 0 | | ||
|
||
tip: | ||
后续考虑设计多定时器样式 依据 type 状态机选择定时器样式 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.