mirror of https://github.com/halo-dev/halo
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
parent
2a37366c92
commit
e8d547e506
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue