mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-21 17:37:29 -07:00
[client] Reset lastFetchScrollTop on MkPagination reload
This commit is contained in:
parent
55f5966343
commit
706ff84d8d
2 changed files with 9 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<MkPagination ref="pagingComponent" :pagination="pagination">
|
<MkPagination ref="pagingComponent" :pagination="pagination" @reload="onReload">
|
||||||
<template #empty>
|
<template #empty>
|
||||||
<div class="_fullinfo">
|
<div class="_fullinfo">
|
||||||
<img
|
<img
|
||||||
|
@ -61,6 +61,10 @@ function scrollTop() {
|
||||||
scroll(tlEl.value, { top: 0, behavior: "smooth" });
|
scroll(tlEl.value, { top: 0, behavior: "smooth" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onReload() {
|
||||||
|
lastFetchScrollTop.value = document.documentElement.clientHeight * -0.5;
|
||||||
|
}
|
||||||
|
|
||||||
function setTimer() {
|
function setTimer() {
|
||||||
if (interval.value || !defaultStore.state.enableInfiniteScroll) return;
|
if (interval.value || !defaultStore.state.enableInfiniteScroll) return;
|
||||||
interval.value = setInterval(() => {
|
interval.value = setInterval(() => {
|
||||||
|
|
|
@ -127,6 +127,7 @@ const props = withDefaults(
|
||||||
);
|
);
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
|
(ev: "reload"): void;
|
||||||
(ev: "queue", count: number): void;
|
(ev: "queue", count: number): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
@ -206,9 +207,10 @@ const reload = (): void => {
|
||||||
init();
|
init();
|
||||||
};
|
};
|
||||||
|
|
||||||
const reloadAsync = (): Promise<void> => {
|
const reloadAsync = async (): Promise<void> => {
|
||||||
items.value = [];
|
items.value = [];
|
||||||
return init();
|
await init();
|
||||||
|
emit("reload");
|
||||||
};
|
};
|
||||||
|
|
||||||
const refresh = async (): Promise<void> => {
|
const refresh = async (): Promise<void> => {
|
||||||
|
|
Loading…
Reference in a new issue