mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-02 20:18:22 +08:00
fix: table pagination current error
This commit is contained in:
parent
1add0d251c
commit
1fb40a31e4
@ -63,20 +63,22 @@ export default function usePagination(
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// ============ Basic Pagination Config ============
|
// ============ Basic Pagination Config ============
|
||||||
const mergedPagination = computed(() =>
|
const mergedPagination = computed(() => {
|
||||||
extendsObject<Partial<TablePaginationConfig>>(innerPagination.value, pagination.value, {
|
const mP = extendsObject<Partial<TablePaginationConfig>>(
|
||||||
total: paginationTotal.value > 0 ? paginationTotal.value : totalRef.value,
|
innerPagination.value,
|
||||||
}),
|
pagination.value,
|
||||||
);
|
{
|
||||||
|
total: paginationTotal.value > 0 ? paginationTotal.value : totalRef.value,
|
||||||
// Reset `current` if data length or pageSize changed
|
},
|
||||||
const maxPage = Math.ceil(
|
);
|
||||||
(paginationTotal.value || totalRef.value) / mergedPagination.value.pageSize!,
|
// Reset `current` if data length or pageSize changed
|
||||||
);
|
const maxPage = Math.ceil((paginationTotal.value || totalRef.value) / mP.pageSize!);
|
||||||
if (mergedPagination.value.current! > maxPage) {
|
if (mP.current! > maxPage) {
|
||||||
// Prevent a maximum page count of 0
|
// Prevent a maximum page count of 0
|
||||||
mergedPagination.value.current = maxPage || 1;
|
mP.current = maxPage || 1;
|
||||||
}
|
}
|
||||||
|
return mP;
|
||||||
|
});
|
||||||
|
|
||||||
const refreshPagination = (current = 1, pageSize?: number) => {
|
const refreshPagination = (current = 1, pageSize?: number) => {
|
||||||
if (pagination.value === false) return;
|
if (pagination.value === false) return;
|
||||||
|
Loading…
Reference in New Issue
Block a user