feat: unify table page size handling with useVrcxVueTable

This commit is contained in:
pa
2026-03-06 23:14:29 +09:00
parent 318f0b141c
commit cf1577cb44
10 changed files with 175 additions and 117 deletions

View File

@@ -503,6 +503,19 @@
set: (size) => handlePageSizeChange(size)
});
// When the current pageSize is not in the available pageSizes list
watch(
[pageSizeProxy, () => props.pageSizes],
([current, sizes]) => {
if (!sizes?.length || sizes.includes(current)) {
return;
}
const nearest = sizes.reduce((prev, s) => (Math.abs(s - current) < Math.abs(prev - current) ? s : prev));
handlePageSizeChange(nearest);
},
{ immediate: true }
);
const pageSizeValue = computed({
get: () => String(pageSizeProxy.value),
set: (value) => handlePageSizeChange(Number(value))