Skip to content

Home > @jview/hooks > useElementContentRect

useElementContentRect() function

封装了计算 dom ContentRect 的 hook

Signature:

typescript
export declare function useElementContentRect(options: Partial<UseElementContentRectOption>): {
    rectData: {
        width: number;
        height: number;
        x: number;
        y: number;
        top: number;
        right: number;
        bottom: number;
        left: number;
    };
    calc: () => void;
};
export declare function useElementContentRect(options: Partial<UseElementContentRectOption>): {
    rectData: {
        width: number;
        height: number;
        x: number;
        y: number;
        top: number;
        right: number;
        bottom: number;
        left: number;
    };
    calc: () => void;
};

Parameters

ParameterTypeDescription
optionsPartial<UseElementContentRectOption>UseElementContentRectOption

Returns:

{ rectData: { width: number; height: number; x: number; y: number; top: number; right: number; bottom: number; left: number; }; calc: () => void; }

rectData(rect 数据), calc(计算触发方法)