1
This commit is contained in:
@@ -175,7 +175,7 @@ export default {
|
||||
comments: [],
|
||||
statistics: null,
|
||||
lastGenerateTime: 0,
|
||||
cooldownTime: 5000, // 5秒冷却时间
|
||||
cooldownTime: 3000, // 5秒冷却时间
|
||||
isButtonDisabled: false
|
||||
}
|
||||
},
|
||||
@@ -200,6 +200,13 @@ export default {
|
||||
this.loadTypes()
|
||||
// 启动定时器更新冷却时间显示
|
||||
this.cooldownTimer = setInterval(() => {
|
||||
// 检查倒计时是否结束,如果结束则清空lastGenerateTime
|
||||
if (this.lastGenerateTime > 0) {
|
||||
const remaining = this.cooldownTime - (Date.now() - this.lastGenerateTime)
|
||||
if (remaining <= 0) {
|
||||
this.lastGenerateTime = 0
|
||||
}
|
||||
}
|
||||
// 强制更新计算属性
|
||||
this.$forceUpdate()
|
||||
}, 1000)
|
||||
|
||||
Reference in New Issue
Block a user