From ce339341ab4fd790ff74d7bf2ae97a068c06d960 Mon Sep 17 00:00:00 2001 From: zhangpaopao Date: Fri, 14 Jul 2023 15:01:03 +0800 Subject: [PATCH] feat(guide): sync --- src/guide/Guide.tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/guide/Guide.tsx b/src/guide/Guide.tsx index 072936703..8aa4ac4b3 100644 --- a/src/guide/Guide.tsx +++ b/src/guide/Guide.tsx @@ -47,6 +47,8 @@ const Guide: React.FC = (originalProps) => { const dialogWrapperRef = useRef(null); // dialog ref const dialogTooltipRef = useRef(null); + // ! popup ref 不确定这里的类型是否完全正确 + const popupTooltipRef = useRef(null); // 是否开始展示 const [active, setActive] = useState(false); // 步骤总数 @@ -87,13 +89,16 @@ const Guide: React.FC = (originalProps) => { }; const showPopupGuide = () => { - currentHighlightLayerElm.current = getTargetElm(currentStepInfo.element); - setTimeout(() => { + currentHighlightLayerElm.current = getTargetElm(currentStepInfo.element); + if (!currentHighlightLayerElm.current) return; scrollToParentVisibleArea(currentHighlightLayerElm.current); setHighlightLayerPosition(highlightLayerRef.current); setHighlightLayerPosition(referenceLayerRef.current); scrollToElm(currentHighlightLayerElm.current); + // fix: https://github.com/Tencent/tdesign-vue-next/issues/2536 + // 这里其实是一个临时解决方案,最合理的是 popup 内部处理 + popupTooltipRef.current?.update(); }); }; @@ -253,6 +258,7 @@ const Guide: React.FC = (originalProps) => {
{!hideSkip && !isLast && (