Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/vue/src/grid/src/tooltip/src/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,16 @@ export default {
}
const tooltip = this.$refs.tooltip
const wrapperElem = cell
const content = cell.innerText.trim() || cell.textContent.trim()
const content = cell.innerText.trim()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing cell.textContent.trim() might cause issues if innerText is not supported or behaves differently across browsers. Ensure that innerText is consistently supported in the environments where this code will run.

const { contentMethod } = this.tooltipConfig
const range = createTooltipRange({ _vm: this, cell, column, isHeader })
const rangeWidth = range.getBoundingClientRect().width
const padding =
(parseInt(getStyle(cell, 'paddingLeft'), 10) || 0) + (parseInt(getStyle(cell, 'paddingRight'), 10) || 0)
const isOverflow =
rangeWidth + padding > cell.getBoundingClientRect().width || wrapperElem.scrollWidth > wrapperElem.clientWidth
// 浏览器缩放情况下,会存在细微的像素无法,因此设置0.1像素作为误差量
rangeWidth + padding > cell.getBoundingClientRect().width + 0.1 ||
wrapperElem.scrollWidth > wrapperElem.clientWidth

// content如果是空字符串,但是用户配置了contentMethod,则同样也可以触发提示
if ((contentMethod || content) && (showTip || isOverflow)) {
Expand Down
Loading