发起单位:
{{ item.fqdw }}
@@ -197,7 +229,7 @@ const getData = async () => {
await http.get("/api/ggfwyth/succour").then((res) => {
if (res.code == 200) {
console.log(res.data);
- data.diversification.hszhxms = res.data.diversification.hszhxms
+ data.diversification.hszhxms = res.data.diversification.hszhxms;
// 专项救助模块
// 教育&医疗
data.education.data = res.data.specialAssistance.education.data;
@@ -221,9 +253,42 @@ const getData = async () => {
}
});
};
+
+//自动滚动
+const mainRef = ref(null);
+let isAutoScrolling = true;
+
+const stopAutoScroll = () => {
+ isAutoScrolling = false;
+};
+
+const startAutoScroll = () => {
+ isAutoScrolling = true;
+ autoScroll();
+};
+
+const autoScroll = () => {
+ if (!isAutoScrolling) return;
+
+ const mainEl = mainRef.value;
+ mainEl.scrollTop += 1; // 每次滚动的距离
+
+ if (mainEl.scrollTop + 1 >= mainEl.scrollHeight - mainEl.clientHeight) {
+ setTimeout(() => {
+ mainEl.scrollTo({ top: 0, behavior: "smooth" });
+ setTimeout(autoScroll, 2000); // 2秒后再次滚动到底部
+ }, 1000); // 暂停1秒后开始快速滚回顶部
+ } else {
+ requestAnimationFrame(autoScroll);
+ }
+};
+
onBeforeMount(() => {
getData();
});
+onMounted(() => {
+ startAutoScroll();
+});