mirror of
https://github.com/element-plus/element-plus.git
synced 2024-12-27 03:01:14 +08:00
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 <winerlu@tencent.com>
This commit is contained in:
parent
815618d7d3
commit
358559e2cf
@ -2,7 +2,7 @@ import { getCurrentInstance } from 'vue'
|
|||||||
import { TableBodyProps } from './table-body'
|
import { TableBodyProps } from './table-body'
|
||||||
import { Table, AnyObject, TableColumnCtx } from '../table.type'
|
import { Table, AnyObject, TableColumnCtx } from '../table.type'
|
||||||
|
|
||||||
function useStyles(props: TableBodyProps) {
|
function useStyles (props: TableBodyProps) {
|
||||||
const instance = getCurrentInstance()
|
const instance = getCurrentInstance()
|
||||||
const parent = instance.parent as Table
|
const parent = instance.parent as Table
|
||||||
const isColumnHidden = index => {
|
const isColumnHidden = index => {
|
||||||
@ -146,7 +146,7 @@ function useStyles(props: TableBodyProps) {
|
|||||||
return columns[index].realWidth
|
return columns[index].realWidth
|
||||||
}
|
}
|
||||||
const widthArr = columns
|
const widthArr = columns
|
||||||
.map(({ realWidth }) => realWidth)
|
.map(({ realWidth, width }) => realWidth || width)
|
||||||
.slice(index, index + colspan)
|
.slice(index, index + colspan)
|
||||||
return widthArr.reduce((acc, width) => acc + width, -1)
|
return widthArr.reduce((acc, width) => acc + width, -1)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user