vue 倒计时插件

真棒倒计时 (vue-awesome-countdown)

Countdown plug-in with high performance and high accuracy for Vue2.5.0+.

适用于Vue2.5.0 +的高性能和高精度倒计时插件。

View Demo 查看演示 Download Source 下载源

安装 (Installation)

Install

安装

$ npm install vue-awesome-countdown --save
# or
$ yarn add vue-awesome-countdown

...and import and use the plugin like so:

...然后像这样导入和使用插件:

import vueAwesomeCountdown from 'vue-awesome-countdown'Vue.use(vueAwesomeCountdown, 'vac') // Component name, `countdown` and `vac` by default

用法 (Usage)

<countdown :end-time="new Date().getTime() + 60000"><spanslot="process"slot-scope="anyYouWantedScopName">{{ `Lefttime: ${anyYouWantedScopName.timeObj.ceil.s}` }}</span><span slot="finish">Done!</span>
</countdown>
<vac :end-time="new Date().getTime() + 60000"><spanslot="process"slot-scope="{ timeObj }">{{ `Lefttime: ${timeObj.m}:${timeObj.s}` }}</span><span slot="finish">Done!</span>
</vac>

SSR(Nuxt) (SSR (Nuxt))

<no-ssr><vac :end-time="new Date().getTime() + 60000"><spanslot="process"slot-scope="{ timeObj }">{{ `Lefttime: ${timeObj.m}:${timeObj.s}` }}</span><span slot="finish">Done!</span></vac>
</no-ssr>

道具 (Props)

Prop Required Explain Type Default
startTime false Time stamp of countdown start [String, Number, Date] null
endTime when leftTime undefined Time stamp of countdown end [String, Number, Date] null
leftTime when endTime undefined Remaining milliseconds of countdown end Number 0
autoStart false Start countdown automatically Boolean true
speed false Unit: millisecond Number 1000
tag false The wrap tag name String span
Struts 需要 说明 类型 默认
开始时间 false 倒计时开始的时间戳 [String, Number, Date] null
时间结束 leftTime未定义时 倒数计时结束时间戳 [String, Number, Date] null
leftTime endTime未定义时 倒数计时结束剩余的毫秒数 Number 0
自动启动 false 自动开始倒数 Boolean true
速度 false 单位:毫秒 Number 1000
标签 false 包装标签名称 String span

数据 (Data)

The data can get it through slot-scop or methods.

数据可以通过slot-scopmethods

Data Explain Default
state The countdown run state, the states are beforeStart, stoped, process and finised beforeStart
attrs The countdown component tag attributes {}
actualEndTime Actual countdown end time null
timeObj Look look {}
countdownTimer The countdown timer function, Do not use as much as possible. null
actualStartTime Actual countdown start time. null
runTimes Countdown run times (The onProcess methods run times) 0
usedTime The total time consuming from the countdown to the end. 0
数据 说明 默认
倒计时运转状态时,状态是beforeStartstopedprocessfinised beforeStart
属性 倒计时组件标签属性 {}
实际结束时间 实际倒数结束时间 null
timeObj 看看 {}
倒计时器 倒数计时器功能,请勿使用过多。 null
实际开始时间 实际倒数开始时间。 null
运行时间 倒计时运行时间( onProcess方法的运行时间) 0
usedTime 从倒数计时到结束的总时间。 0

timeObj (timeObj)

{"endTime": 1542634411361,"speed": 1000,"leftTime": 97019,"d": "0","h": "00","m": "01","s": "37","ms": "019","org": {"d": 0.001134247685185185,"h": 0.02722194444444444,"m": 1.6333166666666665,"s": 37.998999999999995,"ms": 19},"ceil": {"d": 1,"h": 1,"m": 2,"s": 98}
}

插槽 (Slots)

Slot process and slot finish will not display at the same time.

插槽process和插槽finish不会同时显示。

name slot-scop Position Display condition
prev component _self 1 Defined, Controllable display
before component _self 2 On before start, state === 'beforeStart'
process component _self 2 On process, state === 'process'
finish component _self 3 On finish, state === 'finished'
default component _self 3 Defined, Controllable display
名称 插槽范围 位置 显示条件
上一个 组件_self 1个 定义的,可控制的显示
之前 组件_self 2 在启动之前, state === 'beforeStart'
处理 组件_self 2 处理中, state === 'process'
组件_self 3 完成后, state === 'finished'
默认 组件_self 3 定义的,可控制的显示

方法 (Methods)

The methods can be accesse through slot-scop or $refs.

可以通过slot-scop$refs这些方法。

Method Explain Parameters
startCountdown restart
stopCountdown no
switchCountdown no
finishCountdown no
doCountdown no
方法 说明 参量
startCountdown restart
stopCountdown 没有
switchCountdown 没有
finishCountdown 没有
doCountdown 没有

事件 (Event)

Event Explain Parameters
onStart Functions executed at the beginning of countdown vm
onProcess Function executed when countdown is performed vm
onStop Function executed when countdown stops vm
onFinish Function executed when countdown finished vm
事件 说明 参量
onStart 在倒数开始时执行的功能 vm
处理中 执行倒数计时时执行的功能 vm
onStop 倒数停止时执行的功能 vm
onFinish 倒数完成后执行的功能 vm

翻译自: https://vuejsexamples.com/countdown-plug-in-with-high-performance-and-high-accuracy-for-vue/

vue 倒计时插件

vue 倒计时插件_Vue的高性能和高精度倒计时插件相关推荐

  1. use vue 多个_vue.use 插件系统详解

    什么是插件 Vue的插件一般就是用来扩展Vue的功能.比如,当需要Vue实现Ajax请求功能,我们希望通过this.$get(url)的形式就可以发送一个get请求.那么,我们就需要给Vue的实例添加 ...

  2. 查漏补缺方为上策!!两万六字总结vue的基本使用和高级特性,周边插件vuex和vue-router任你挑选

    vue的基本使用和高级特性,周边插件vuex和vue-router 一.vue的使用 1.vue-cli 2.基本使用 (1)模板(插值,指令) (2)computed和watch (3)class和 ...

  3. 前端Vue实现手机号验证码登录(60s禁用倒计时)

    这篇文章主要介绍了Vue实现手机号验证码登录(60s禁用倒计时),帮助大家更好的理解和使用vue,具有很好的参考价值,感兴趣的朋友可以了解下 最近做了个vue项目,前端通过手机号验证码的方式登录,获取 ...

  4. 在vue中使用海康插件实现视频实时监控(海康插件)

    在vue中使用海康插件实现视频实时监控(海康插件) 首先 下载并安装海康插件 webcontrol.exe 然后 直接就写代码把,所有方法都是海康他们直接封装好的demo 初始化之后,后台把密钥和一些 ...

  5. vue纯手写思维导图,拒绝插件(cv即用)

    vue纯手写思维导图,拒绝插件(cv即用) 已完成功能点:折叠.放大.缩小.移动 后续增加功能点:添加.删除 先看结果: 有这么个需求,按照层级关系,把表格放在思维导图上,我第一时间想到用插件,但是找 ...

  6. IntelliJ IDEA 的插件 常用的 idea 好用 idea 插件 以此收藏防丢失

    IntelliJ IDEA 的插件 常用的 idea 好用 idea 插件 以此收藏防丢失 1. AiXcoder Code completer 强烈安利!!! 它以快速的提示代码,修复某些输入错的中 ...

  7. jquery十秒倒计时_10个很棒的jQuery倒计时脚本

    jquery十秒倒计时 在大多数网站(如RapidShare,MegaUpload等)中,我们已经看到了足够的倒计时功能示例,这些示例可让您下载文件,但让您等待指定的秒数,然后才能获得下载链接. 我们 ...

  8. 如何在Pycham中安装插件,以及Pycham中常用的插件

    欢迎大家关注笔者,你的关注是我持续更博的最大动力 原创文章,转载告知,盗版必究 文章目录:如何在Pycham中安装插件,以及Pycham中常用的插件 1.在Pycham中安装插件 1.1 直接安装 1 ...

  9. JQuery自定义插件详解之Banner图滚动插件

      前  言 JRedu JQuery是什么相信已经不需要详细介绍了.作为时下最火的JS库之一,JQuery将其"Write Less,Do More!"的口号发挥的极致.而帮助J ...

  10. 【Android Gradle 插件】Extension 扩展类型 ( Module 引入插件类型 | application 插件 | library 插件 | Variants 变体列表 )

    文章目录 一.Module 引入插件类型 1.com.android.application 插件 2.com.android.library 插件 二.Extension 扩展类型 三.applic ...

最新文章

  1. 使用LVS(Linux Virtual Server)在Linux上搭建负载均衡的集群服务
  2. linux centos7 /tmp目录 自动清理规则
  3. python中remove函数是什么意思,python中pop函数和remove函数有什么区别
  4. 用了那么多年的 Master 分支或因种族歧视而成为历史?
  5. xen虚拟机克隆命令
  6. 三行情书代码_用三行代码优化您的交易策略
  7. Python中矩阵库Numpy基本操作
  8. python字典和集合对象可以进行索引操作_Python中的字典跟集合整理笔记
  9. 提供了一个UBUNTU安装NVIDIA驱动的脚本的下载
  10. 桂林理工大学 2020秋程序设计实践课程 课程设计与实习报告
  11. 深入解析Windows操作系统 第4版
  12. Php ui 3dmax,3dMAX 7-2020 3264位 SP1 sp2更新补丁合集及修复说明
  13. MySQL触发器写入Sqlseever_sqlserver 触发器实例
  14. 华为手机怎么把计算机放到桌面,将华为手机投影到计算机屏幕
  15. PS基础操作之图像处理(一)
  16. c#Winform自定义控件-目录
  17. 计算机文化基础项目化教程答案,第七版计算机文化基础实践教程 第3-4章习题答案及解析...
  18. iOS底层原理:weak的实现原理
  19. java 报错 定位,问题定位分享(2)spark任务一定几率报错java.lang.NoSuchFieldError: HIVE_MOVE_FILES_THREAD_COUNT...
  20. Spark创建空的DataFrame

热门文章

  1. 如何把SWF转为PDF文件
  2. 测试网络速度的软件 哪款好,网络测速工具有哪些?2018网络测速工具推荐
  3. 360电脑网速怎么测试软件,win7使用360安全卫士测试网速的方法 win7攻略
  4. office使用latex公式
  5. 医院建筑综合布线方案特点
  6. 昂达v80 plus linux,8英寸便携平板 昂达V80 Plus一体工艺来袭
  7. 信息系统软件配置、过程管理、开发工具(详细介绍)
  8. 网页视频播放器代码大全 + 21个为您的网站和博客提供的免费视频播放器
  9. 点击换图 秀米的svg_能换色的.svg图片怎么用?看这篇就够了!
  10. matlab在傅里叶里的应用,MATLAB在傅里叶变换中的应用