From e8d547e50663a572f260cb1f53515e13325a0ccb Mon Sep 17 00:00:00 2001 From: Takagi <1103069291@qq.com> Date: Tue, 2 Sep 2025 15:03:00 +0800 Subject: [PATCH] fix: resolve the pagination issue of the select formkit component using remote data (#7726) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /kind bug /area ui #### What this PR does / why we need it: 目前 Select 组件使用远程接口请求数据时,如果存在分页的数据则分页请求可以超过分页数量。 此 PR 限制了分页请求的次数。 #### Does this PR introduce a user-facing change? ```release-note 解决使用 Select 组件远程请求数据时的分页问题 ``` --- ui/src/formkit/inputs/select/SelectMain.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ui/src/formkit/inputs/select/SelectMain.vue b/ui/src/formkit/inputs/select/SelectMain.vue index e62734713..f59e8a0c0 100644 --- a/ui/src/formkit/inputs/select/SelectMain.vue +++ b/ui/src/formkit/inputs/select/SelectMain.vue @@ -737,8 +737,18 @@ const handleSearch = async (value: string, event?: Event) => { } }; +const hasNextPage = computed(() => { + const totalPages = Math.ceil(total.value / size.value); + return ( + hasMoreOptions.value && + !isFetchingMore.value && + !isLoading.value && + page.value < totalPages + ); +}); + const handleNextPage = async () => { - if (!hasMoreOptions.value || isFetchingMore.value || isLoading.value) { + if (!hasNextPage.value) { return; } isFetchingMore.value = true;