GithubHelp home page GithubHelp logo

lhz333 / vue-timer-countdown Goto Github PK

View Code? Open in Web Editor NEW

This project forked from realgeoffrey/vue-timer-countdown

0.0 1.0 0.0 42 KB

倒计时(Vue组件)

Home Page: https://realgeoffrey.com/vue-timer-countdown/demo/index.html

License: MIT License

JavaScript 26.47% Vue 73.53%

vue-timer-countdown's Introduction

vue-timer-countdown

Vue的倒计时组件

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

安装

  1. Node.js安装

    npm install vue-timer-countdown --save
  2. 浏览器引用

    <!-- 需要先引入vue:<script src="//unpkg.com/vue"></script> -->
    <script src="//unpkg.com/vue-timer-countdown"></script>

注册组件

  1. Node.js注册

    1. 全局注册

      import Vue from 'vue'
      import vueTimerCountdown from 'vue-timer-countdown'
      
      // 全局注册
      Vue.use(vueTimerCountdown, { component: 'TimerCountdown' }) // 组件名默认是:timer-countdown
      // 或:Vue.component('TimerCountdown', vueTimerCountdown)
    2. 局部注册

      import vueTimerCountdown from 'vue-timer-countdown'
      
      export default {
        components: {
          // 局部注册
          TimerCountdown: vueTimerCountdown
        }
      }
  2. 浏览器注册

    1. 全局注册

      <!-- 需要先引入vue:<script src="//unpkg.com/vue"></script> -->
      <!-- 需要先引入vue-timer-countdown:<script src="//unpkg.com/vue-timer-countdown"></script> -->
      
      <script>
      // 全局注册
      Vue.use(vueTimerCountdown, { component: 'timer-countdown' }) // 组件名默认是:timer-countdown
      // 或:Vue.component('timer-countdown', vueTimerCountdown)
      </script>
    2. 局部注册

      <!-- 需要先引入vue:<script src="//unpkg.com/vue"></script> -->
      <!-- 需要先引入vue-timer-countdown:<script src="//unpkg.com/vue-timer-countdown"></script> -->
      
      <script>
      new Vue({
        components: {
          // 局部注册
          'timer-countdown': vueTimerCountdown
        }
      })
      </script>

用法

  1. 参数

    <TimerCountdown
      :deadline="倒计时剩余时间-秒(必填)"
      :complete-zero="补全0true"
      :left-second="提前到期-秒(0"
      :ignore-day="true:展示到小时;false:展示到天(true"
      @done="倒计时结束后回调的方法"
      @update="每秒渲染结束后回调的方法,带参数{ day, hour, minute, second, restSecond }(展示的天、小时、分钟、秒,总共剩余的秒)"
    />
  2. 插槽

    <TimerCountdown
      :deadline="倒计时剩余时间-秒(必填)"
      v-slot="time"
    >
      {{ time.day }}天
      {{ time.hour }}时
      {{ time.minute }}分
      {{ time.second }}秒
    </TimerCountdown>

vue-timer-countdown's People

Contributors

realgeoffrey avatar

Watchers

James Cloos 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.