iking-utils-test
Version:
金合前端工具库(1.2.9版本之后需要注册KEY)
32 lines (31 loc) • 1.78 kB
TypeScript
import type { FunctionArgs } from '@vueuse/core';
export interface ViewportOffsetResult {
left: number;
top: number;
right: number;
bottom: number;
rightIncludeBody: number;
bottomIncludeBody: number;
}
export declare function getBoundingClientRect(element: Element): DOMRect | number;
export declare function hasClass(el: Element, cls: string): boolean;
export declare function addClass(el: Element, cls: string): void;
export declare function removeClass(el: Element, cls: string): void;
/**
* Get the left and top offset of the current element
* left: the distance between the leftmost element and the left side of the document
* top: the distance from the top of the element to the top of the document
* right: the distance from the far right of the element to the right of the document
* bottom: the distance from the bottom of the element to the bottom of the document
* rightIncludeBody: the distance between the leftmost element and the right side of the document
* bottomIncludeBody: the distance from the bottom of the element to the bottom of the document
*
* @description:
*/
export declare function getViewportOffset(element: Element): ViewportOffsetResult;
export declare function hackCss(attr: string, value: string): any;
export declare function on(element: Element | HTMLElement | Document | Window, event: string, handler: EventListenerOrEventListenerObject): void;
export declare function off(element: Element | HTMLElement | Document | Window, event: string, handler: Fn): void;
export declare function once(el: HTMLElement, event: string, fn: EventListener): void;
export declare function useRafThrottle<T extends FunctionArgs>(fn: T): T;
export declare const addStyelsheet: (href: string) => void;