Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(table): fix ellipsis status #4555

Merged
merged 1 commit into from
Sep 11, 2024
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
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
Loading