https://github.com/realgeoffrey/react-time-countdown
倒计时(React组件)
https://github.com/realgeoffrey/react-time-countdown
countdown-timer countdowntimer react
Last synced: about 1 year ago
JSON representation
倒计时(React组件)
- Host: GitHub
- URL: https://github.com/realgeoffrey/react-time-countdown
- Owner: realgeoffrey
- License: mit
- Created: 2021-10-28T11:35:07.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-06-20T13:38:26.000Z (almost 3 years ago)
- Last Synced: 2025-02-27T05:04:03.004Z (over 1 year ago)
- Topics: countdown-timer, countdowntimer, react
- Language: TypeScript
- Homepage: https://realgeoffrey.github.io/react-time-countdown/demo/index.html
- Size: 556 KB
- Stars: 8
- Watchers: 5
- Forks: 3
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-time-countdown
React的倒计时组件
1. npm:
2. demo:
### 安装-引用
1. Node.js
```shell
npm install react-time-countdown --save
```
```tsx
import TimeCountdown from 'react-time-countdown'
```
2. 浏览器
```html
const TimeCountdown = window['react-time-countdown'].default
```
### 用法
```tsx
{
// 倒计时结束时执行的回调函数
}}
leftMillisecond={提前到期的毫秒数(0)}
renderMillisecond={(millisecond: number): React.ReactNode => {
// 参数:倒计时还剩下多少毫秒
// 返回:渲染本组件
}}
intervalDelay={每次调用渲染的间隔时间,毫秒(1000)}
/>
```
### 开发调试
```shell
# 监听改变
yarn start
# 运行开发demo
cd dev
yarn start
```
```shell
# 构建生产环境文件
yarn build
```