diff --git a/src/table/base-table.tsx b/src/table/base-table.tsx index 994a48c73..3554e58a3 100644 --- a/src/table/base-table.tsx +++ b/src/table/base-table.tsx @@ -67,6 +67,7 @@ export default defineComponent({ const { global } = useConfig('table'); const { isMultipleHeader, spansAndLeafNodes, thList } = useTableHeader(props); const finalColumns = computed(() => spansAndLeafNodes.value?.leafColumns || props.columns); + const isIE = computed(() => getIEVersion() <= 11); // 吸附相关ref 用来做视图resize后重新定位 const paginationAffixRef = ref(); @@ -306,6 +307,7 @@ export default defineComponent({ horizontalScrollAffixRef, headerTopAffixRef, footerBottomAffixRef, + isIE, }; }, @@ -360,13 +362,12 @@ export default defineComponent({ renderFixedHeader(columns: BaseTableCol[]) { if (!this.showHeader) return null; const isVirtual = this.virtualConfig.isVirtualScroll.value; - const isIE = getIEVersion() <= 11; const barWidth = this.isWidthOverflow ? this.scrollbarWidth : 0; // IE 浏览器需要遮挡 header 吸顶滚动条,要减去 getBoundingClientRect.height 的滚动条高度 4 像素 - const IEHeaderWrap = isIE ? 4 : 0; + const IEHeaderWrap = this.isIE ? 4 : 0; const affixHeaderHeight = (this.affixHeaderRef?.getBoundingClientRect().height || 0) - IEHeaderWrap; // IE 浏览器不需要减去横向滚动条的宽度 - const affixHeaderWrapHeight = affixHeaderHeight - (isIE ? 0 : barWidth); + const affixHeaderWrapHeight = affixHeaderHeight - (this.isIE ? 0 : barWidth); // 两类场景:1. 虚拟滚动,永久显示表头,直到表头消失在可视区域; 2. 表头吸顶,根据滚动情况判断是否显示吸顶表头 const headerOpacity = this.headerAffixedTop ? Number(this.showAffixHeader) : 1; const affixHeaderWrapHeightStyle = { @@ -375,8 +376,8 @@ export default defineComponent({ opacity: headerOpacity, }; const colgroup = this.renderColGroup(columns, true); - // 多级表头左边线缺失 - const affixedLeftBorder = this.bordered ? 1 : 0; + // 多级表头左边线缺失,IE不需要 + const affixedLeftBorder = this.bordered && !this.isIE ? 1 : 0; const affixedHeader = Boolean((this.headerAffixedTop || isVirtual) && this.tableWidth) && (
[]) { const barWidth = this.isWidthOverflow ? this.scrollbarWidth : 0; - // 多级表头左边线缺失 - const affixedLeftBorder = this.bordered ? 1 : 0; + // 多级表头左边线缺失, IE不需要 + const affixedLeftBorder = this.bordered && !this.isIE ? 1 : 0; let marginScrollbarWidth = barWidth; if (this.bordered) { marginScrollbarWidth += 1;