Merge branch 'main' into shen

bak
Dragon 1 year ago
commit c2ed424995

@ -11,6 +11,7 @@ const activeId = ref("");
const el = ref<HTMLDivElement | null>(null); const el = ref<HTMLDivElement | null>(null);
const keyword = ref(""); const keyword = ref("");
const canloadMore = ref(true); const canloadMore = ref(true);
const isLoading = ref(false);
defineProps({ defineProps({
showFieldList: { showFieldList: {
@ -29,7 +30,7 @@ function selectHandler(id: string, index: number) {
taskStore.setActive(index); taskStore.setActive(index);
} }
const { isLoading } = useInfiniteScroll( useInfiniteScroll(
el as any, el as any,
() => { () => {
loadMore(); loadMore();
@ -39,8 +40,13 @@ const { isLoading } = useInfiniteScroll(
async function loadMore() { async function loadMore() {
if (isLoading.value || el.value == null) return; if (isLoading.value || el.value == null) return;
const more = await fetchList(); isLoading.value = true;
data.value.push(...more); try {
const more = await fetchList();
data.value.push(...more);
} finally {
isLoading.value = false;
}
} }
async function fetchList() { async function fetchList() {

Loading…
Cancel
Save