Skip to content

Commit

Permalink
fix: width for ellipsisText tooltip in popover content
Browse files Browse the repository at this point in the history
* 修复省略文本用在气泡中时,提示弹出层的宽度计算有误的问题
  • Loading branch information
mynetfan committed Feb 12, 2025
1 parent 5262233 commit 2f3a729
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { computed, ref, watchEffect } from 'vue';
import { VbenTooltip } from '@vben-core/shadcn-ui';
import { useElementSize } from '@vueuse/core';
interface Props {
/**
* 是否启用点击文本展开全部
Expand Down Expand Up @@ -78,11 +80,13 @@ const ellipsis = ref();
const isExpand = ref(false);
const defaultTooltipMaxWidth = ref();
const { width: eleWidth } = useElementSize(ellipsis);
watchEffect(
() => {
if (props.tooltip && ellipsis.value) {
if (props.tooltip && eleWidth.value) {
defaultTooltipMaxWidth.value =
props.tooltipMaxWidth ?? ellipsis.value.offsetWidth + 24;
props.tooltipMaxWidth ?? eleWidth.value + 24;
}
},
{ flush: 'post' },
Expand Down

0 comments on commit 2f3a729

Please sign in to comment.