This commit is contained in:
parent
aeb8722224
commit
97bf08d6d1
|
@ -129,15 +129,15 @@
|
|||
</div>
|
||||
<div class="flex1">
|
||||
<div class="yd_title last"></div>
|
||||
|
||||
<div
|
||||
class="t"
|
||||
class="table"
|
||||
ref="mainRef"
|
||||
@mouseenter="stopAutoScroll"
|
||||
@mouseleave="startAutoScroll"
|
||||
>
|
||||
<div class="table" ref="mainRef">
|
||||
<div class="item" v-for="item in data.jkhd">
|
||||
{{ item.jkhd }}
|
||||
</div>
|
||||
<div class="item" v-for="item in data.jkhd">
|
||||
{{ item.jkhd }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -196,13 +196,12 @@ const autoScroll = () => {
|
|||
const mainEl = mainRef.value;
|
||||
mainEl.scrollTop += 1; // 每次滚动的距离
|
||||
|
||||
if (mainEl.scrollTop+1 >= mainEl.scrollHeight - mainEl.clientHeight) {
|
||||
if (mainEl.scrollTop + 1 >= mainEl.scrollHeight - mainEl.clientHeight) {
|
||||
setTimeout(() => {
|
||||
mainEl.scrollTo({ top: 0, behavior: "smooth" });
|
||||
setTimeout(autoScroll, 2000); // 2秒后再次滚动到底部
|
||||
}, 1000); // 暂停1秒后开始快速滚回顶部
|
||||
} else {
|
||||
|
||||
requestAnimationFrame(autoScroll);
|
||||
}
|
||||
};
|
||||
|
@ -212,7 +211,11 @@ onBeforeMount(async () => {
|
|||
});
|
||||
onMounted(() => {
|
||||
startAutoScroll();
|
||||
console.log(mainRef.value.scrollTop,mainRef.value.scrollHeight,mainRef.value.clientHeight);
|
||||
console.log(
|
||||
mainRef.value.scrollTop,
|
||||
mainRef.value.scrollHeight,
|
||||
mainRef.value.clientHeight
|
||||
);
|
||||
});
|
||||
const getData = async () => {
|
||||
await http.get("/api/ggfwyth/health").then((res) => {
|
||||
|
|
Loading…
Reference in New Issue