From 2e5e7f54c6c1e51373fe808c6e3b0fef8d50aef2 Mon Sep 17 00:00:00 2001 From: xpyjs Date: Mon, 1 Jul 2024 11:29:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=B8=AD=E7=BA=BF?= =?UTF-8?q?=E9=AB=98=E5=BA=A6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/root/index.vue | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/components/root/index.vue b/src/components/root/index.vue index d503667..ea8dae5 100644 --- a/src/components/root/index.vue +++ b/src/components/root/index.vue @@ -35,7 +35,7 @@ 'xg-mid-separate-line', { 'xg-mid-separate-line__dark': isDark } ]" - :style="{ height: $param.rootHeight + 'px' }" + :style="{ height: separateLineHeight + 'px' }" />
{ - $param.rootHeight = Math.max( - ganttRef.value!.$el.offsetHeight, - ganttRef.value!.$el.clientHeight + const getHeight = () => + Math.max( + ganttRef.value!.$el.offsetHeight, + ganttRef.value!.$el.clientHeight + ); + + $param.rootHeight = getHeight(); + separateLineHeight.value = getHeight(); + + // 切换数据时,如果没有固定高度,那么整个高度应该随之变化。rootHeight 会决定渲染行数 + watch( + () => props.data, + () => { + $param.rootHeight = getHeight(); + nextTick(() => { + separateLineHeight.value = getHeight(); + }); + } ); }); // #endregion