Giter Site home page Giter Site logo

messixten / react-time-countdown Goto Github PK

View Code? Open in Web Editor NEW

This project forked from realgeoffrey/react-time-countdown

0.0 0.0 0.0 569 KB

倒计时(React组件)

Home Page: https://realgeoffrey.github.io/react-time-countdown/demo/index.html

License: MIT License

TypeScript 93.28% HTML 6.72%

react-time-countdown's Introduction

react-time-countdown

React的倒计时组件

  1. npm:https://www.npmjs.com/package/react-time-countdown
  2. demo:https://realgeoffrey.github.io/react-time-countdown/demo/index.html

安装-引用

  1. Node.js

    npm install react-time-countdown --save
    import TimeCountdown from 'react-time-countdown'
  2. 浏览器

    <!-- 需要先引入react技术栈:
        <script src='//unpkg.com/react@18/umd/react.production.min.js'></script>
        <script src='//unpkg.com/react-dom@18/umd/react-dom.production.min.js'></script>
    
        <script src='//unpkg.com/babel-standalone@6/babel.min.js'></script>
    -->
    <script src="//unpkg.com/react-time-countdown"></script>
    
    <script>
    const TimeCountdown = window['react-time-countdown'].default
    </script>

用法

<TimeCountdown
  deadlineTimestamp={结束时间戳(必填)}
  callback={() => {
    // 倒计时结束时执行的回调函数
  }}
  leftMillisecond={提前到期的毫秒数(0)}
  renderMillisecond={(millisecond: number): React.ReactNode => {
    // 参数:倒计时还剩下多少毫秒
    // 返回:渲染本组件
  }}
  intervalDelay={每次调用渲染的间隔时间,毫秒(1000)}
/>

开发调试

# 监听改变
yarn start

# 运行开发demo
cd dev
yarn start
# 构建生产环境文件
yarn build

react-time-countdown's People

Contributors

dependabot[bot] avatar realgeoffrey avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.