Commit 9d17b86be91fc1ae99247822b7eb07ec12e892f9

Authored by ww
1 parent 73f83cde

fix: 修复无数据情况下表格高度设置撑满

@@ -398,8 +398,6 @@ @@ -398,8 +398,6 @@
398 display: flex; 398 display: flex;
399 align-items: center; 399 align-items: center;
400 justify-content: center; 400 justify-content: center;
401 - height: 670px;  
402 - max-height: 670px;  
403 } 401 }
404 } 402 }
405 403
@@ -88,7 +88,7 @@ export function useTableScroll( @@ -88,7 +88,7 @@ export function useTableScroll(
88 88
89 bodyEl!.style.height = 'unset'; 89 bodyEl!.style.height = 'unset';
90 90
91 - if (!unref(getCanResize) || tableData.length === 0) return; 91 + if (!unref(getCanResize)) return;
92 92
93 await nextTick(); 93 await nextTick();
94 //Add a delay to get the correct bottomIncludeBody paginationHeight footerHeight headerHeight 94 //Add a delay to get the correct bottomIncludeBody paginationHeight footerHeight headerHeight
@@ -143,7 +143,12 @@ export function useTableScroll( @@ -143,7 +143,12 @@ export function useTableScroll(
143 height = (height > maxHeight! ? (maxHeight as number) : height) ?? height; 143 height = (height > maxHeight! ? (maxHeight as number) : height) ?? height;
144 setHeight(height); 144 setHeight(height);
145 145
146 - bodyEl!.style.height = `${height}px`; 146 + if (tableData.length) {
  147 + bodyEl!.style.height = `${height}px`;
  148 + } else {
  149 + const emptyPlaceholder: HTMLDivElement = tableEl.querySelector('.ant-table-placeholder')!;
  150 + emptyPlaceholder && (emptyPlaceholder.style.height = `${height}px`);
  151 + }
147 } 152 }
148 useWindowSizeFn(calcTableHeight, 280); 153 useWindowSizeFn(calcTableHeight, 280);
149 onMountedOrActivated(() => { 154 onMountedOrActivated(() => {