Skip to content

Home > @jview/hooks > useResizeObserver

useResizeObserver() function

ResizeObserver hook,封装了一些便捷的逻辑

Signature:

typescript
export declare function useResizeObserver(options: Partial<UseResizeObserverOption>): {
    startObserve: (options?: ResizeObserverOptions) => void;
    stopObserve: () => void;
};
export declare function useResizeObserver(options: Partial<UseResizeObserverOption>): {
    startObserve: (options?: ResizeObserverOptions) => void;
    stopObserve: () => void;
};

Parameters

ParameterTypeDescription
optionsPartial<UseResizeObserverOption>UseResizeObserverOption

Returns:

{ startObserve: (options?: ResizeObserverOptions) => void; stopObserve: () => void; }

startObserve(开始观察), stopObserve(停止观察)