瀏覽代碼

fix: fix table auto height

vben 4 年之前
父節點
當前提交
ddc3786b16
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      src/components/Table/src/hooks/useTableScroll.ts

+ 3 - 2
src/components/Table/src/hooks/useTableScroll.ts

@@ -77,7 +77,7 @@ export function useTableScroll(refProps: ComputedRef<BasicTableProps>, tableElRe
     if (el) {
       headerHeight = (el as HTMLElement).offsetHeight;
     }
-    const tHeight =
+    tableHeightRef.value =
       bottomIncludeBody -
       (resizeHeightOffset || 0) -
       paddingHeight -
@@ -86,7 +86,8 @@ export function useTableScroll(refProps: ComputedRef<BasicTableProps>, tableElRe
       footerHeight -
       headerHeight;
     useTimeout(() => {
-      tableHeightRef.value = tHeight > maxHeight! ? (maxHeight as number) : tableHeightRef.value;
+      tableHeightRef.value =
+        tableHeightRef.value! > maxHeight! ? (maxHeight as number) : tableHeightRef.value;
       cb && cb();
     }, 0);
   }