From 358559e2cfe4a9d4fb6c4881a272b6f358fbbaff Mon Sep 17 00:00:00 2001 From: justwiner <30335393+justwiner@users.noreply.github.com> Date: Mon, 1 Feb 2021 21:42:20 +0800 Subject: [PATCH] fix(table): fix that the column width is calculated incorrectly (#1381) Fix the bug that the column width is calculated incorrectly when dragging the header fix #1355 Co-authored-by: winerlu --- packages/table/src/table-body/styles-helper.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/table/src/table-body/styles-helper.ts b/packages/table/src/table-body/styles-helper.ts index 7e310b12b1..4b06438da7 100644 --- a/packages/table/src/table-body/styles-helper.ts +++ b/packages/table/src/table-body/styles-helper.ts @@ -2,7 +2,7 @@ import { getCurrentInstance } from 'vue' import { TableBodyProps } from './table-body' import { Table, AnyObject, TableColumnCtx } from '../table.type' -function useStyles(props: TableBodyProps) { +function useStyles (props: TableBodyProps) { const instance = getCurrentInstance() const parent = instance.parent as Table const isColumnHidden = index => { @@ -146,7 +146,7 @@ function useStyles(props: TableBodyProps) { return columns[index].realWidth } const widthArr = columns - .map(({ realWidth }) => realWidth) + .map(({ realWidth, width }) => realWidth || width) .slice(index, index + colspan) return widthArr.reduce((acc, width) => acc + width, -1) }