From 333cab0858a4383ed0bb683955018a09e4f2eb95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90?= Date: Mon, 9 Jan 2023 23:20:54 +0800 Subject: [PATCH] fix(paginator): item count less than buffer --- composables/paginator.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/composables/paginator.ts b/composables/paginator.ts index 2b85bb16..62861b0c 100644 --- a/composables/paginator.ts +++ b/composables/paginator.ts @@ -66,7 +66,10 @@ export function usePaginator( if (result.value?.length) { const preprocessedItems = preprocess([...nextItems.value, ...result.value]) as any - const itemsToShowCount = preprocessedItems.length - buffer + const itemsToShowCount + = preprocessedItems.length < buffer + ? preprocessedItems.length + : preprocessedItems.length - buffer nextItems.value = preprocessedItems.slice(itemsToShowCount) items.value.push(...preprocessedItems.slice(0, itemsToShowCount)) state.value = 'idle'