fix: 列表显示、分页优化
This commit is contained in:
@@ -180,3 +180,13 @@ export function usePagination(options: UsePaginationOptions = {}): UsePagination
|
||||
refresh,
|
||||
};
|
||||
}
|
||||
|
||||
/** 将接口返回的分页 total 同步到 pagination(支持 number / 数字字符串,含 0) */
|
||||
export function syncPaginationTotal(
|
||||
pagination: Pick<UsePaginationReturn, 'setTotal'>,
|
||||
total: unknown,
|
||||
): void {
|
||||
if (total == null || total === '') return;
|
||||
const n = Number(total);
|
||||
if (Number.isFinite(n)) pagination.setTotal(n);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user