wujingjing
2024-12-31 7357a3709ebeb22f28c17a21f103d0c715213b34
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { ref } from 'vue';
 
/**
 * 检测文本是否溢出
 */
export const useTextOverflow = () => {
    const disableTooltip = ref(false);
 
    const textMouseOver = (e: Event) => {
        const target = e.currentTarget as HTMLDivElement;
        disableTooltip.value = target.scrollWidth <= target.clientWidth;
    };
 
    return { disableTooltip, textMouseOver };
};