Skip to content

Commit

Permalink
fix(table): fix ellpsis status (#4555)
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn authored Sep 11, 2024
1 parent d58f7a7 commit 335930b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/table/ellipsis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ export default defineComponent({
const onTriggerMouseleave = () => {
if (!root.value) return;
};

const handleVisibleChange = (v: boolean) => {
if (!v) flag.value = false;
};
// 使用 debounce 有两个原因:1. 避免 safari/firefox 等浏览器不显示省略浮层;2. 避免省略列快速滚动时,出现一堆的省略浮层
const onMouseAround = debounce((e: MouseEvent) => {
e.type === 'mouseleave' ? onTriggerMouseleave() : onTriggerMouseenter();
Expand All @@ -93,11 +95,13 @@ export default defineComponent({
ellipsisClasses,
innerEllipsisClassName,
onMouseAround,
handleVisibleChange,
};
},

render() {
const cellNode = renderContent(this, 'default', 'content');

const ellipsisContent = (
<div
ref="root"
Expand All @@ -123,6 +127,7 @@ export default defineComponent({
overlayClassName: tooltipProps?.overlayClassName
? this.innerEllipsisClassName.concat(tooltipProps.overlayClassName)
: this.innerEllipsisClassName,
onVisibleChange: this.handleVisibleChange,
...tooltipProps,
};
content = <TTooltip {...rProps}>{ellipsisContent}</TTooltip>;
Expand Down

0 comments on commit 335930b

Please sign in to comment.