diff --git a/packages/core/useScroll/index.ts b/packages/core/useScroll/index.ts index b664565fec2..0988c125eb4 100644 --- a/packages/core/useScroll/index.ts +++ b/packages/core/useScroll/index.ts @@ -1,6 +1,6 @@ import { computed, reactive, ref } from 'vue-demi' import type { MaybeRefOrGetter } from '@vueuse/shared' -import { noop, toValue, useDebounceFn, useThrottleFn } from '@vueuse/shared' +import { noop, toValue, tryOnMounted, useDebounceFn, useThrottleFn } from '@vueuse/shared' import { useEventListener } from '../useEventListener' import type { ConfigurableWindow } from '../_configurable' import { defaultWindow } from '../_configurable' @@ -250,6 +250,10 @@ export function useScroll( eventListenerOptions, ) + tryOnMounted(() => { + setArrivedState(toValue(element)) + }) + useEventListener( element, 'scrollend',