fix(活动页): 修复可能会在周一00:00:00不刷新的问题
This commit is contained in:
parent
68fb65fca7
commit
4afbca8d96
@ -816,15 +816,17 @@ const formatTime = (value) => {
|
||||
return value < 10 ? `0${value}` : value
|
||||
}
|
||||
|
||||
const targetTime = ref(getNextMonday()) // 闭包保存目标时间 (核心修正)
|
||||
|
||||
// 更新倒计时
|
||||
const getCountdown = () => {
|
||||
const now = Date.now()
|
||||
const targetTime = getNextMonday()
|
||||
let diff = targetTime - now
|
||||
let diff = targetTime.value - now
|
||||
|
||||
if (diff <= 0) {
|
||||
diff = getNextMonday() - now
|
||||
updatePageData() // 刷新页面数据
|
||||
targetTime.value += 7 * 86400000 // +7天 (更新闭包变量)
|
||||
diff = targetTime.value - now
|
||||
}
|
||||
|
||||
// 计算时间单位
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user