UNPKG

@jiaozhiye/qm-design-vue

Version:

A Component Library for Vue3.0

78 lines (77 loc) 3.16 kB
import { CSSProperties } from 'vue'; import type { Nullable } from './types'; export declare const on: (element: Element | HTMLElement | Document | Window, event: string, handler: EventListenerOrEventListenerObject) => void; export declare const off: (element: Element | HTMLElement | Document | Window, event: string, handler: EventListenerOrEventListenerObject) => void; export declare const once: (el: HTMLElement, event: string, fn: EventListener) => void; export declare const stop: (ev: Event) => void; export declare const prevent: (ev: Event) => void; /** * @description 获取元素样式 * @param {HTMLNode} element 元素节点 * @param {string} styleName css 属性名称 * @returns css 样式的值 */ export declare const getStyle: (element: HTMLElement, styleName: string) => Nullable<string>; /** * @description 设置元素样式 * @param {HTMLNode} element 元素节点 * @param {string} styleName css 属性名称 * @param {string} value css 属性的值 * @returns */ export declare const setStyle: (element: HTMLElement, styleName: CSSProperties | string, value?: string) => void; /** * @description 移除元素样式 * @param {HTMLNode} element 元素节点 * @param {string} styleName css 属性名称 * @returns */ export declare const removeStyle: (element: HTMLElement, styleName: CSSProperties | string) => void; /** * @description 判断目标元素在坐标上,是否在参考节点里边 * @param {HTMLNode} el 目标节点 * @param {HTMLNode} container 参考节点 * @returns boolean */ export declare const isInContainer: (el: HTMLElement, container: HTMLElement) => boolean; /** * @description 获取元素距离窗口顶部的上边距 * @param {HTMLNode} el 元素节点 * @returns 上边距的值 */ export declare const getOffsetTop: (el: HTMLElement) => number; /** * @description 获取目标元素距离参考节点的上边距 * @param {HTMLNode} el 目标节点 * @param {HTMLNode} container 参考节点 * @returns 上边距的值 */ export declare const getOffsetTopDistance: (el: HTMLElement, container: HTMLElement) => number; /** * @description 获取元素距离窗口的横纵坐标 * @param {HTMLNode} el 目标节点 * @returns 横纵坐标的值 */ export declare const getPosition: (el: HTMLElement) => Record<'x' | 'y', number>; /** * @description 获取满足条件的祖先元素 * @param {HTMLNode} el 参考节点 * @param {string} selector 目标节点 classname * @returns 满足条件的祖先元素 */ export declare const getParentNode: (el: HTMLElement, selector: string) => Nullable<HTMLElement>; /** * @description 判断目标元素是否为参考节点的后代 * @param {HTMLNode} el 目标元素 * @param {HTMLNode} container 目标节点 * @returns boolean */ export declare const contains: (el: HTMLElement, container: HTMLElement) => boolean; /** * @description 滚动到指定位置,动画效果 * @param {HTMLNode} el 带滚动条元素 * @param {number} t 滚动条上边距 * @returns */ export declare const scrollToY: (el: HTMLElement, t: number) => void; export declare const scrollToX: (el: HTMLElement, l: number) => void;