1- import { tryOnScopeDispose } from '@vueuse/shared'
1+ import { type MaybeRefOrGetter , toValue , tryOnScopeDispose } from '@vueuse/shared'
22import { computed , watch } from 'vue-demi'
3- import type { MaybeComputedElementRef } from '../unrefElement'
3+ import type { MaybeComputedElementRef , MaybeElement } from '../unrefElement'
44import { unrefElement } from '../unrefElement'
55import { useSupported } from '../useSupported'
66import type { ConfigurableWindow } from '../_configurable'
@@ -47,7 +47,7 @@ declare class ResizeObserver {
4747 * @param options
4848 */
4949export function useResizeObserver (
50- target : MaybeComputedElementRef | MaybeComputedElementRef [ ] ,
50+ target : MaybeComputedElementRef | MaybeComputedElementRef [ ] | MaybeRefOrGetter < MaybeElement [ ] > ,
5151 callback : ResizeObserverCallback ,
5252 options : UseResizeObserverOptions = { } ,
5353) {
@@ -62,10 +62,12 @@ export function useResizeObserver(
6262 }
6363 }
6464
65- const targets = computed ( ( ) =>
66- Array . isArray ( target )
67- ? target . map ( el => unrefElement ( el ) )
68- : [ unrefElement ( target ) ] )
65+ const targets = computed ( ( ) => {
66+ const _targets = toValue ( target )
67+ return Array . isArray ( _targets )
68+ ? _targets . map ( el => unrefElement ( el ) )
69+ : [ unrefElement ( _targets ) ]
70+ } )
6971
7072 const stopWatch = watch (
7173 targets ,
0 commit comments