This commit is contained in:
李志鹏
2025-09-22 11:01:28 +08:00
parent a1bbc2d166
commit 9d51fac99f
4 changed files with 15 additions and 28 deletions

View File

@@ -565,18 +565,14 @@ export default defineComponent({
createTimer() {
this.timer = setInterval(() => {
this.time--;
if (!this.time) {
clearInterval(this.timer);
}
if (this.time <= 0) this.clearTimer(0);
}, 1000);
},
//清除定时器
clearTimer() {
this.time = 60;
if (this.timer) {
clearInterval(this.timer);
}
clearTimer(time?: number) {
this.time = time == undefined ? 60 : time;
if (this.timer) clearInterval(this.timer);
},
//跳转到首页

View File

@@ -565,18 +565,14 @@ export default defineComponent({
createTimer() {
this.timer = setInterval(() => {
this.time--;
if (!this.time) {
clearInterval(this.timer);
}
if (this.time <= 0) this.clearTimer(0);
}, 1000);
},
//清除定时器
clearTimer() {
this.time = 60;
if (this.timer) {
clearInterval(this.timer);
}
clearTimer(time?: number) {
this.time = time == undefined ? 60 : time;
if (this.timer) clearInterval(this.timer);
},
//跳转到首页

View File

@@ -563,22 +563,18 @@ export default defineComponent({
});
},
//创建定时器
//创建定时器
createTimer() {
this.timer = setInterval(() => {
this.time--;
if (!this.time) {
clearInterval(this.timer);
}
if (this.time <= 0) this.clearTimer(0);
}, 1000);
},
//清除定时器
clearTimer() {
this.time = 60;
if (this.timer) {
clearInterval(this.timer);
}
clearTimer(time?: number) {
this.time = time == undefined ? 60 : time;
if (this.timer) clearInterval(this.timer);
},
//跳转到首页