Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(table): affixed header 1px #1305

Merged
merged 1 commit into from
Aug 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/table/base-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -324,19 +324,19 @@ export default defineComponent({
const affixHeaderHeight = (this.affixHeaderRef?.getBoundingClientRect().height || 0) - IEHeaderWrap;
const affixHeaderWrapHeight = affixHeaderHeight - barWidth - borderWidth;
// 两类场景:1. 虚拟滚动,永久显示表头,直到表头消失在可视区域; 2. 表头吸顶,根据滚动情况判断是否显示吸顶表头
const headerOpacity = props.headerAffixedTop ? Number(this.showAffixHeader) : 1;
const headerOpacity = this.headerAffixedTop ? Number(this.showAffixHeader) : 1;
const affixHeaderWrapHeightStyle = {
width: `${this.tableWidth}px`,
height: `${affixHeaderWrapHeight}px`,
opacity: headerOpacity,
marginTop: onlyVirtualScrollBordered ? `${borderWidth}px` : 0,
};
// 多级表头左边线缺失
const affixedMultipleHeaderLeftBorder = this.bordered && this.isMultipleHeader ? 1 : 0;
const affixedLeftBorder = this.bordered ? 1 : 0;
const affixedHeader = Boolean((this.headerAffixedTop || this.isVirtual) && this.tableWidth) && (
<div
ref="affixHeaderRef"
style={{ width: `${this.tableWidth - affixedMultipleHeaderLeftBorder}px`, opacity: headerOpacity }}
style={{ width: `${this.tableWidth - affixedLeftBorder}px`, opacity: headerOpacity }}
class={['scrollbar', { [this.tableBaseClass.affixedHeaderElm]: this.headerAffixedTop || this.isVirtual }]}
>
<table class={this.tableElmClasses} style={{ ...this.tableElementStyles, width: `${this.tableElmWidth}px` }}>
Expand Down Expand Up @@ -383,7 +383,7 @@ export default defineComponent({
>
<div
ref="affixFooterRef"
style={{ width: `${this.tableWidth}px`, opacity: Number(this.showAffixFooter) }}
style={{ width: `${this.tableWidth - affixedLeftBorder}px`, opacity: Number(this.showAffixFooter) }}
class={['scrollbar', { [this.tableBaseClass.affixedFooterElm]: this.footerAffixedBottom || this.isVirtual }]}
>
<table class={this.tableElmClasses} style={{ ...this.tableElementStyles, width: `${this.tableElmWidth}px` }}>
Expand Down