fixed: Fixed tooltip issue with switch button

This commit is contained in:
zhaojisen
2024-07-11 10:47:33 +08:00
parent d22079446f
commit e93e78307c

View File

@@ -26,7 +26,8 @@ Object.assign(Table.components.TableBody.methods, {
const range = document.createRange()
range.setStart(cellChild, 0)
range.setEnd(cellChild, cellChild.childNodes.length)
const rangeWidth = range.getBoundingClientRect().width
// rangeWidth 有可能是小数,因此就会导致原本 rangeWidth + padding = cellChild.offsetWidth 的大于了 cellChild.offsetWidth
const rangeWidth = Math.floor(range.getBoundingClientRect().width)
const padding = (parseInt(getStyle(cellChild, 'paddingLeft'), 10) || 0) +
(parseInt(getStyle(cellChild, 'paddingRight'), 10) || 0)
if (