This commit is contained in:
姚宇浩 2024-05-28 14:41:01 +08:00
parent aeb8722224
commit 97bf08d6d1
1 changed files with 11 additions and 8 deletions

View File

@ -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) => {