fix bug
This commit is contained in:
@@ -60,30 +60,31 @@ const getTextStyle = (top, index) => {
|
||||
};
|
||||
watch(
|
||||
() => props.onComplete,
|
||||
(newVal, oldVal) => {
|
||||
if (newVal && !oldVal) {
|
||||
if (timer.value) {
|
||||
(newVal) => {
|
||||
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);
|
||||
timer.value = null;
|
||||
setTimeout(newVal, 1500);
|
||||
return;
|
||||
}
|
||||
timer.value = setInterval(() => {
|
||||
const count = Math.round(
|
||||
(
|
||||
(totalHeight + (currentTop.value + rowHeight / 3)) /
|
||||
rowHeight
|
||||
).toFixed(1)
|
||||
);
|
||||
if (count === 10) {
|
||||
clearInterval(timer.value);
|
||||
timer.value = null;
|
||||
setTimeout(() => {
|
||||
newVal();
|
||||
}, 1500);
|
||||
} else {
|
||||
currentTop.value += 2;
|
||||
}
|
||||
}, 40);
|
||||
}
|
||||
// 这里不重置,如果运行超13秒,就不会循环了
|
||||
if (currentTop.value >= -4) {
|
||||
currentTop.value = -totalHeight;
|
||||
} else {
|
||||
currentTop.value += 2;
|
||||
}
|
||||
}, 40);
|
||||
}
|
||||
);
|
||||
onMounted(() => {
|
||||
|
||||
Reference in New Issue
Block a user