From ad7623cc1d1af2336e69036a3a9ab2e2bc1f8d62 Mon Sep 17 00:00:00 2001 From: Gimmy <975402925@qq.com> Date: Wed, 26 Feb 2025 15:18:32 +0800 Subject: [PATCH] fix(grid): [grid ] fix grid show overflow tip error when navigator scale --- packages/vue/src/grid/src/tooltip/src/methods.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/vue/src/grid/src/tooltip/src/methods.ts b/packages/vue/src/grid/src/tooltip/src/methods.ts index 4977658087..bbf673648b 100644 --- a/packages/vue/src/grid/src/tooltip/src/methods.ts +++ b/packages/vue/src/grid/src/tooltip/src/methods.ts @@ -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() 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)) {