From 8855f246c91f8b56d561eb86b86c99669db99de8 Mon Sep 17 00:00:00 2001 From: AlanYu <35493996+smallnine9@users.noreply.github.com> Date: Mon, 15 May 2023 16:10:39 +0800 Subject: [PATCH] fix(useScroll): support window in setArrivedState (#3086) Co-authored-by: yulj5 --- packages/core/useScroll/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/core/useScroll/index.ts b/packages/core/useScroll/index.ts index c2c75902b8b..e064e7342ab 100644 --- a/packages/core/useScroll/index.ts +++ b/packages/core/useScroll/index.ts @@ -162,7 +162,9 @@ export function useScroll( const setArrivedState = (target: HTMLElement | SVGElement | Window | Document | null | undefined) => { const el = ( - target === document ? (target as Document).documentElement : target + target === window + ? (target as Window).document.documentElement + : target === document ? (target as Document).documentElement : target ) as HTMLElement const { display, flexDirection } = getComputedStyle(el)