This commit is contained in:
kron
2025-11-08 12:18:34 +08:00
parent b0a4c7bea5
commit 571073d7ec

View File

@@ -60,30 +60,31 @@ const getTextStyle = (top, index) => {
}; };
watch( watch(
() => props.onComplete, () => props.onComplete,
(newVal, oldVal) => { (newVal) => {
if (newVal && !oldVal) { if (timer.value) {
if (timer.value) { clearInterval(timer.value);
timer.value = null;
}
timer.value = setInterval(() => {
const count = Math.round(
(
(totalHeight + (currentTop.value + rowHeight / 3)) /
rowHeight
).toFixed(1)
);
if (count === 10) {
clearInterval(timer.value); clearInterval(timer.value);
timer.value = null; timer.value = null;
setTimeout(newVal, 1500);
return;
} }
timer.value = setInterval(() => { // 这里不重置如果运行超13秒就不会循环了
const count = Math.round( if (currentTop.value >= -4) {
( currentTop.value = -totalHeight;
(totalHeight + (currentTop.value + rowHeight / 3)) / } else {
rowHeight currentTop.value += 2;
).toFixed(1) }
); }, 40);
if (count === 10) {
clearInterval(timer.value);
timer.value = null;
setTimeout(() => {
newVal();
}, 1500);
} else {
currentTop.value += 2;
}
}, 40);
}
} }
); );
onMounted(() => { onMounted(() => {