fix 分页字段配置问题

This commit is contained in:
xiaoma
2021-08-28 11:18:33 +08:00
parent a0490e3b97
commit ae001fc7bd
2 changed files with 7 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ import type { BasicTableProps } from '../types/table';
import { computed, unref, ref, ComputedRef } from 'vue';
import { isBoolean } from '@/utils/is';
import { DEFAULTPAGESIZE, PAGESIZES } from '../const';
import { APISETTING, DEFAULTPAGESIZE, PAGESIZES } from '../const';
export function usePagination(refProps: ComputedRef<BasicTableProps>) {
const configRef = ref<PaginationProps>({});
@@ -14,6 +14,7 @@ export function usePagination(refProps: ComputedRef<BasicTableProps>) {
if (!unref(show) || (isBoolean(pagination) && !pagination)) {
return false;
}
const { pageField, totalField } = APISETTING;
return {
pageSize: DEFAULTPAGESIZE,
pageSizes: PAGESIZES,
@@ -21,6 +22,8 @@ export function usePagination(refProps: ComputedRef<BasicTableProps>) {
showQuickJumper: true,
...(isBoolean(pagination) ? {} : pagination),
...unref(configRef),
page: unref(configRef)[pageField],
pageCount: unref(configRef)[totalField],
};
});