fix: resolve the pagination issue of the select formkit component using remote data (#7726)

#### 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 组件远程请求数据时的分页问题
```
pull/7738/head^2
Takagi 2025-09-02 15:03:00 +08:00 committed by GitHub
parent 2a37366c92
commit e8d547e506
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 1 deletions

View File

@ -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;