From 07c0aad1bdca0e541362285ef1d7f78df37ee25d Mon Sep 17 00:00:00 2001 From: yulj5 Date: Thu, 11 May 2023 16:23:06 +0800 Subject: [PATCH] fix(useScroll) support window in setArrivedState --- packages/core/useScroll/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/core/useScroll/index.ts b/packages/core/useScroll/index.ts index c2c75902b8b..3c26b721309 100644 --- a/packages/core/useScroll/index.ts +++ b/packages/core/useScroll/index.ts @@ -161,6 +161,9 @@ export function useScroll( const onScrollEndDebounced = useDebounceFn(onScrollEnd, throttle + idle) const setArrivedState = (target: HTMLElement | SVGElement | Window | Document | null | undefined) => { + if (target === window) + target = target.document + const el = ( target === document ? (target as Document).documentElement : target ) as HTMLElement