Skip to content

Commit 046a2d2

Browse files
committed
fix: fix grid width error when grid has scrollbar
1 parent d04efe4 commit 046a2d2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/vue/src/grid/src/table/src/methods.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,8 +1016,8 @@ const Methods = {
10161016
let { fit, columnStore, columnChart, isGroup } = this
10171017
let tableHeight = bodyEl.offsetHeight
10181018
let overflowY = bodyEl.scrollHeight > bodyEl.clientHeight
1019-
// 解决缩放时会出现滚动条的问题
1020-
let bodyW = Math.floor(bodyEl.getBoundingClientRect().width)
1019+
// 当浏览器缩放时,实际宽度会出现小数点,clientWidth会取整,此处减去1px解决缩放时会出现滚动条的问题
1020+
let bodyW = bodyEl.clientWidth - 1
10211021
let { leftList, rightList } = columnStore
10221022

10231023
// 此处操作很重要,这里会计算所有列的宽度并且计算出表格整体宽度

0 commit comments

Comments
 (0)