Skip to content

Commit

Permalink
fix(table): 解决设置height时,高度误差问题 (#483)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocean-gao authored Oct 7, 2023
1 parent a91a18a commit 665eb39
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions components/table/useTableLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ export default function useTableLayout({
? headerWrapperRef.value
: { offsetHeight: 0 };
const headerWrapperHeight = $headerWrapper.offsetHeight;
// 减去wrapperRef的border-bottom
const remainBodyHeight = props.height - headerWrapperHeight - 1;
let remainBodyHeight = props.height - headerWrapperHeight;
if (props.bordered) {
remainBodyHeight -= 2;
}
bodyHeight.value = remainBodyHeight;
const bodyWrapperHeight = $bodyWrapper.offsetHeight;
if (remainBodyHeight < bodyWrapperHeight) {
Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/components/table/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ app.use(FTable);

| 属性 | 说明 | 类型 | 可选值 | 默认值 |
| --------------------- | ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------- | ---------- |
| bordered | 是否展示列边框 | boolean | - | `false` |
| bordered | 是否展示表格边框 | boolean | - | `false` |
| horizontalLine | 是否展示水平分割线 | boolean | - | `true` |
| verticalLine | 是否展示垂直分割线 | boolean | - | `false` |
| rowClassName | 行的 className 的回调方法,也可以使用字符串为所有行设置一个固定的 className。 | string \| object \| array \| ({ row, column, rowIndex, columnIndex, cellValue })=> ( object \| array \| string ) | - | - |
Expand Down

0 comments on commit 665eb39

Please sign in to comment.