From 5afea2f36f6a3a53c1d72fa37804f58a8f134a62 Mon Sep 17 00:00:00 2001 From: saller Date: Sat, 7 Oct 2023 15:44:30 +0800 Subject: [PATCH] fix(comp:text): text blinks when content doesn't exceed one row (#1706) --- packages/components/text/src/composables/useEllipsis.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/components/text/src/composables/useEllipsis.ts b/packages/components/text/src/composables/useEllipsis.ts index d21cc0969..536b59adb 100644 --- a/packages/components/text/src/composables/useEllipsis.ts +++ b/packages/components/text/src/composables/useEllipsis.ts @@ -104,6 +104,7 @@ export function useEllipsis( const walk = () => { const measureHeight = measureRef.value?.offsetHeight ?? 0 + const conentHeight = contentRef.value?.offsetHeight ?? 0 if (measureStatus.value === 'preparing') { if (!rowMeasureRef.value) { @@ -112,8 +113,7 @@ export function useEllipsis( rowHeight = rowMeasureRef.value?.offsetHeight ?? 0 maxHeight = rows.value * rowHeight - - if (measureHeight <= maxHeight) { + if (conentHeight <= maxHeight || measureHeight <= maxHeight) { setIsEllipsis(false) setLastRenderIndex(contentNodesLength.value) currentWalk = undefined @@ -172,6 +172,10 @@ export function useEllipsis( immediate: true, }) useResizeObserver(contentRef, () => { + if (measureStatus.value !== 'none') { + return + } + const width = contentRef.value?.offsetWidth ?? 0 if (width !== contentWidth.value) {