mv-count-down
vue 倒计时组件
3,259
| Install | |
|---|---|
npm install mv-count-down |
|
| Latest Version: | 0.1.15 |
| Vue: | 2 |
| License: | MIT |
| Last Updated: | Sep 11, 2019 |
| Links: | npm |
Maintainer: qq1013480204
mv-count-down
vue 倒计时组件
Project setup
yarn add mv-count-down
or
npm i mv-count-down
Project use
<template>
<div class="home">
<mv-count-down @startCallback="countDownS"
@endCallback="countDownE"
:startTime="startTime"
:endTime="endTime"
:endText="endText"
:dayTxt="'day'"
:hourTxt="'hours'"
:minutesTxt="'minutes'"
:secondsTxt="'seconds'"
: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 '@/components/MvCountDown'
export default {
name: 'home',
components: {
MvCountDown
},
data () {
return {
startTime: new Date().getTime(), // Start time (timestamp)
endTime: 0, // Completion time (timestamp)
endText: '', // Countdown completed prompt text
isStart: false // Control the timing of the start of the countdown (asynchronous request completion start)
}
},
created () {
this.setEndTime(10);
},
methods: {
callback () {
// coding .......
},
// Sets how many seconds to delay the end time and turn the timestamp
setEndTime (value) {
let curTime = new Date();
let newTime = new Date(curTime.setSeconds(curTime.getSeconds() + value));
this.endTime = newTime.getTime();
this.isStart = true;
},
countDownS (x) {
// Start countdown callback
console.log(x)
},
countDownE () {
// End countdown callback
this.callback();
}
}
}
</script>
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 0.1.15 | ^2.6.10 | MIT | |
| 0.1.14 | ^2.6.10 | MIT | |
| 0.1.13 | ^2.6.10 | MIT | |
| 0.1.11 | ^2.6.10 | MIT | |
| 0.1.10 | ^2.6.10 | MIT | |
| 0.1.9 | ^2.6.10 | MIT | |
| 0.1.8 | ^2.6.10 | MIT | |
| 0.1.7 | ^2.6.10 | MIT | |
| 0.1.6 | ^2.6.10 | MIT | |
| 0.1.4 | ^2.6.10 | MIT | |
| 0.1.3 | ^2.6.10 | MIT | |
| 0.1.2 | ^2.6.10 | MIT | |
| 0.1.1 | ^2.6.10 | MIT | |
| 0.1.0 | ^2.6.10 | MIT |