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 && (