From 1e6c68a28da9ed5b7bf6acdfce4d05b09d6aa838 Mon Sep 17 00:00:00 2001 From: XiaoDaiGua-Ray <51957438+XiaoDaiGua-Ray@users.noreply.github.com> Date: Sat, 9 Mar 2024 22:36:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96useResizeObserver?= =?UTF-8?q?=EF=BC=8C=E9=81=BF=E5=85=8D=E5=9C=A8=E9=9D=9E=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E5=99=A8=E7=8E=AF=E5=A2=83=E4=B8=8BisSupported=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E6=AD=A3=E7=A1=AE=E6=A3=80=E6=B5=8B=EF=BC=9B=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E6=B2=A1=E6=84=8F=E4=B9=89=E7=9A=84deep=E7=9B=91?= =?UTF-8?q?=E5=90=AC=20(#186)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hooks/src/useResizeObserver/index.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/hooks/src/useResizeObserver/index.ts b/packages/hooks/src/useResizeObserver/index.ts index c7b54ea..8e4d2b3 100644 --- a/packages/hooks/src/useResizeObserver/index.ts +++ b/packages/hooks/src/useResizeObserver/index.ts @@ -9,7 +9,7 @@ export type ResizeObserverCallback = ( export interface UseResizeObserverOptions { /** - * The box the observer is observing changes to. + * The box the observer is observing changes to. * The default is content-box. * * @default 'content-box' @@ -28,7 +28,7 @@ export default function useResizeObserver( options?: UseResizeObserverOptions, ): UseResizeObserverReturnType { const { box = 'content-box', ...argsOptions } = options ?? {} - const isSupported = ref('ResizeObserver' in window) + const isSupported = ref(window && 'ResizeObserver' in window) let ob: ResizeObserver | null const modelTargets = computed(() => Array.isArray(target) ? target.map(curr => getTargetElement(curr)) : [getTargetElement(target)], @@ -61,7 +61,6 @@ export default function useResizeObserver( { flush: 'post', immediate: true, - deep: true, }, )