This commit is contained in:
Last 2025-03-08 05:11:20 +08:00
parent 3dc759235a
commit 57a6e31b44

View File

@ -97,28 +97,24 @@ const 屏幕宽高重置 = () => {
WIDTH.value = 列宽
};
const disabled = ref(false); //
const inadvance = ref(400); //
const page = ref(3) //
const disabled = ref(false) //
const inadvance = ref(400) //
const page = ref(3); //
const nextPage = () => {
fetch(`/api/gallery?page=${page.value}`).then((res) => {
page.value = page.value + 1;
disabled.value = false;
if (res.status === 200) {
res.json().then((rest) => {
data.value = data.value.concat(rest)
});
fetch(`/api/gallery?page=${page.value}`).then(res => res.json()).then(data => {
page.value = page.value + 1
disabled.value = !!data.length
data.value = data.value.concat(data)
})
}
});
};
const handleScroll = () => {
if (disabled.value) return;
const { scrollHeight, scrollTop, clientHeight } = document.documentElement;
if (scrollHeight - scrollTop - clientHeight <= inadvance.value) {
disabled.value = true //
console.log("scroll to bottom");
disabled.value = true; //
inadvance.value = 1280; // 使
nextPage();
}