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