|
@@ -76,10 +76,6 @@ const countdownTimer = {
|
|
|
default: false,
|
|
default: false,
|
|
|
type: Boolean
|
|
type: Boolean
|
|
|
},
|
|
},
|
|
|
- rest: {
|
|
|
|
|
- default: 0,
|
|
|
|
|
- type: Number
|
|
|
|
|
- },
|
|
|
|
|
interval: {
|
|
interval: {
|
|
|
default: 1000,
|
|
default: 1000,
|
|
|
type: Number
|
|
type: Number
|
|
@@ -99,7 +95,7 @@ const countdownTimer = {
|
|
|
const rest = restTime(this.restTime);
|
|
const rest = restTime(this.restTime);
|
|
|
const {d, h, m, s} = rest;
|
|
const {d, h, m, s} = rest;
|
|
|
if(!this.showDays && d > 0) {
|
|
if(!this.showDays && d > 0) {
|
|
|
- rest.h += d * 24;
|
|
|
|
|
|
|
+ rest.h = Number(rest.h) + d * 24;
|
|
|
rest.d = 0;
|
|
rest.d = 0;
|
|
|
}
|
|
}
|
|
|
return rest;
|
|
return rest;
|
|
@@ -107,7 +103,7 @@ const countdownTimer = {
|
|
|
plainText() {
|
|
plainText() {
|
|
|
const {d, h, m, s} = this.resttime;
|
|
const {d, h, m, s} = this.resttime;
|
|
|
|
|
|
|
|
- return `${d > 0 && this.showDays? d + '天': h}小时${m}分${s}秒`;
|
|
|
|
|
|
|
+ return `${d > 0 && this.showDays? d + '天' + h: h}小时${m}分${s}秒`;
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
@@ -120,14 +116,16 @@ const countdownTimer = {
|
|
|
|
|
|
|
|
this.restTime = end - (start + diffTime);
|
|
this.restTime = end - (start + diffTime);
|
|
|
this.timer = setInterval(() => {
|
|
this.timer = setInterval(() => {
|
|
|
- let restTime = end - (new Date().getTime() + diffTime);
|
|
|
|
|
- restTime -= 1000;
|
|
|
|
|
- this.restTime = restTime;
|
|
|
|
|
- if(restTime < 0) {
|
|
|
|
|
- this.restTime = 0;
|
|
|
|
|
- clearInterval(this.timer);
|
|
|
|
|
|
|
+ if(!this.paused) {
|
|
|
|
|
+ let restTime = end - (new Date().getTime() + diffTime);
|
|
|
|
|
+ restTime -= 1000;
|
|
|
|
|
+ this.restTime = restTime;
|
|
|
|
|
+ if(restTime < 0) {
|
|
|
|
|
+ this.restTime = 0;
|
|
|
|
|
+ clearInterval(this.timer);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }, 1000);
|
|
|
|
|
|
|
+ }, this.interval);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|