From e062895b93f07a4ccf76519ef2be7a496689eda1 Mon Sep 17 00:00:00 2001 From: huangpiqiao <649041955@qq.com> Date: Wed, 8 Mar 2023 16:08:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=94=B1=E4=BA=8E?= =?UTF-8?q?=E8=A1=A8=E5=A4=B4=E5=B7=A6=E8=BE=B9=E7=BA=BF=E7=BC=BA=E5=B0=91?= =?UTF-8?q?=E5=87=8F=E5=B0=911=E5=83=8F=E7=B4=A0=E5=90=8E=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E5=9C=A8IE=E4=B8=8Aaffix=E8=A1=A8=E5=A4=B4=E5=92=8C?= =?UTF-8?q?=E8=A1=A8=E5=B0=BE=E5=87=BA=E7=8E=B0=E6=BB=9A=E5=8A=A8=E6=9D=A1?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/table/base-table.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) 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;