From 3bf62edd66b012fa1d4f59d7afca23ea39e8514e Mon Sep 17 00:00:00 2001 From: cutestnekoaqua Date: Thu, 19 Jan 2023 00:00:36 +0100 Subject: [PATCH] wip --- .../client/src/components/MkPagination.vue | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/client/src/components/MkPagination.vue b/packages/client/src/components/MkPagination.vue index fe1c56550..c262ee931 100644 --- a/packages/client/src/components/MkPagination.vue +++ b/packages/client/src/components/MkPagination.vue @@ -110,14 +110,17 @@ const init = async (): Promise => { if (!props.pagination.noPaging && (res.length > (props.pagination.limit || 10))) { res.pop(); items.value = props.pagination.reversed ? [...res].reverse() : res; + if (props.externalItemArray) { + props.externalItemArray.value = items.value; + } more.value = true; } else { items.value = props.pagination.reversed ? [...res].reverse() : res; + if (props.externalItemArray) { + props.externalItemArray.value = items.value; + } more.value = false; } - if (props.externalItemArray) { - props.externalItemArray.value = items.value; - } offset.value = res.length; error.value = false; fetching.value = false; @@ -191,14 +194,17 @@ const fetchMore = async (): Promise => { if (res.length > SECOND_FETCH_LIMIT) { res.pop(); items.value = props.pagination.reversed ? [...res].reverse().concat(items.value) : items.value.concat(res); + if (props.externalItemArray) { + props.externalItemArray.value = items.value; + } more.value = true; } else { items.value = props.pagination.reversed ? [...res].reverse().concat(items.value) : items.value.concat(res); + if (props.externalItemArray) { + props.externalItemArray.value = items.value; + } more.value = false; } - if (props.externalItemArray) { - props.externalItemArray.value = items.value; - } offset.value += res.length; moreFetching.value = false; }, err => {