diff --git a/components/vc-tour/hooks/useTarget.ts b/components/vc-tour/hooks/useTarget.ts index fad1873b0..d51488874 100644 --- a/components/vc-tour/hooks/useTarget.ts +++ b/components/vc-tour/hooks/useTarget.ts @@ -43,6 +43,10 @@ export default function useTarget( const [posInfo, setPosInfo] = useState(null); const updatePos = () => { + if (!open.value) { + setPosInfo(null); + return; + } if (targetElement.value) { // Exist target element. We should scroll and get target position if (!isInViewPort(targetElement.value) && open.value) {