mirror of https://github.com/jeecgboot/jeecg-boot
【issues/8374】分页始终显示在底部
parent
fc05fe1aff
commit
9ddad931ff
|
@ -222,7 +222,7 @@
|
||||||
// update-end--author:sunjianlei---date:220230630---for:【QQYUN-5571】自封装选择列,解决数据行选择卡顿问题
|
// update-end--author:sunjianlei---date:220230630---for:【QQYUN-5571】自封装选择列,解决数据行选择卡顿问题
|
||||||
);
|
);
|
||||||
|
|
||||||
const { getScrollRef, redoHeight } = useTableScroll(getProps, tableElRef, getColumnsRef, getRowSelectionRef, getDataSourceRef, slots);
|
const { getScrollRef, redoHeight } = useTableScroll(getProps, tableElRef, getColumnsRef, getRowSelectionRef, getDataSourceRef, slots, getPaginationInfo);
|
||||||
|
|
||||||
const { customRow } = useCustomRow(getProps, {
|
const { customRow } = useCustomRow(getProps, {
|
||||||
setSelectedRowKeys,
|
setSelectedRowKeys,
|
||||||
|
|
|
@ -15,7 +15,8 @@ export function useTableScroll(
|
||||||
columnsRef: ComputedRef<BasicColumn[]>,
|
columnsRef: ComputedRef<BasicColumn[]>,
|
||||||
rowSelectionRef: ComputedRef<TableRowSelection<any> | null>,
|
rowSelectionRef: ComputedRef<TableRowSelection<any> | null>,
|
||||||
getDataSourceRef: ComputedRef<Recordable[]>,
|
getDataSourceRef: ComputedRef<Recordable[]>,
|
||||||
slots: Slots
|
slots: Slots,
|
||||||
|
getPaginationInfo: ComputedRef<any>
|
||||||
) {
|
) {
|
||||||
const tableHeightRef: Ref<Nullable<number>> = ref(null);
|
const tableHeightRef: Ref<Nullable<number>> = ref(null);
|
||||||
|
|
||||||
|
@ -144,6 +145,27 @@ export function useTableScroll(
|
||||||
setHeight(height);
|
setHeight(height);
|
||||||
|
|
||||||
bodyEl!.style.height = `${height}px`;
|
bodyEl!.style.height = `${height}px`;
|
||||||
|
// update-begin--author:liaozhiyang---date:20240609---for【issues/8374】分页始终显示在底部
|
||||||
|
if (maxHeight === undefined) {
|
||||||
|
if (unref(getPaginationInfo) && unref(getDataSourceRef).length) {
|
||||||
|
const pageSize = unref(getPaginationInfo)?.pageSize;
|
||||||
|
const current = unref(getPaginationInfo)?.current;
|
||||||
|
const total = unref(getPaginationInfo)?.total;
|
||||||
|
const tableBody = tableEl.querySelector('.ant-table-body') as HTMLElement;
|
||||||
|
const tr = tableEl.querySelector('.ant-table-tbody')?.children ?? [];
|
||||||
|
const lastrEl = tr[tr.length - 1] as HTMLElement;
|
||||||
|
const trHeight = lastrEl.offsetHeight;
|
||||||
|
const dataHeight = trHeight * pageSize;
|
||||||
|
if (tableBody && lastrEl) {
|
||||||
|
if (current === 1 && pageSize > unref(getDataSourceRef).length && total <= pageSize) {
|
||||||
|
tableBody.style.height = `${height}px`;
|
||||||
|
} else {
|
||||||
|
tableBody.style.height = `${dataHeight < height ? dataHeight : height}px`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// update-end--author:liaozhiyang---date:20240609---for【issues/8374】分页始终显示在底部
|
||||||
}
|
}
|
||||||
useWindowSizeFn(calcTableHeight, 280);
|
useWindowSizeFn(calcTableHeight, 280);
|
||||||
onMountedOrActivated(() => {
|
onMountedOrActivated(() => {
|
||||||
|
|
Loading…
Reference in New Issue