在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:mv-count-down开源软件地址:https://gitee.com/null_639_5368/mv-count-down开源软件介绍:mv-count-downvue 倒计时组件 安装yarn add mv-count-downornpm i mv-count-down 在线演示http://null_639_5368.gitee.io/mv-count-down 使用<template> <div class="home"> <mv-count-down @startCallback="countDownS" @endCallback="countDownE" :startTime="startTime" :endTime="endTime" :endText="endText" :dayTxt="'天'" :hourTxt="'小时'" :minutesTxt="'分钟'" :secondsTxt="'秒'" :isStart="isStart"></mv-count-down> <a class="link-blue" href="https://gitee.com/null_639_5368/mv-count-down/blob/master/src/views/Home.vue">查看demo</a> </div></template><script>import MvCountDown from 'mv-count-down'export default { name: 'home', components: MvCountDown }, data () { return { startTime: new Date().getTime(), // 开始时间(时间戳) endTime: 0, // 完成的时间(时间戳) endText: '', // 倒计时完成的提示文本 isStart: false // 控制倒计时开始的时机(异步请求完成开启) } }, created () { this.setEndTime(10); }, methods: { callback () { // coding ....... }, // 设置结束时间推迟多少秒并转时间戳 setEndTime (value) { let curTime = new Date(); let newTime = new Date(curTime.setSeconds(curTime.getSeconds() + value)); this.endTime = newTime.getTime(); this.isStart = true; }, countDownS (x) { // 开始倒计时回调 console.log(x) }, countDownE () { // 结束倒计时回调 this.callback(); } }}</script> 赞助万分感谢各位,作者也就 2 年经验以后多加努力。 |
2022-08-15
2022-08-17
2022-09-23
2023-10-27
2022-08-18
请发表评论