autofit.js/index.d.ts

58 lines
1.7 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

export interface IgnoreOption {
el: string;
height?: string;
width?: string;
scale?: number;
fontSize?: number;
}
export interface AutofitOption {
el?: string;
dw?: number;
dh?: number;
resize?: boolean;
ignore?: (IgnoreOption | string)[];
transition?: number;
delay?: number;
limit?: number;
}
declare interface autofit {
/**
* 参数列表
* 对象:
*
* @param {AutofitOption|String|undefined} options
* @param {boolean|undefined} isShowInitTip
* - 传入对象,对象中的属性如下:
* - el可选渲染的元素默认是 "body"
* - dw可选设计稿的宽度默认是 1920
* - dh可选设计稿的高度默认是 1080
* - resize可选是否监听resize事件默认是 true
* - ignore(可选)忽略缩放的元素该元素将反向缩放参数见readme.md
* - transition可选过渡时间默认是 0
* - delay可选延迟默认是 0
*/
init(options?: AutofitOption | String, isShowInitTip?: boolean): void;
/**
* @param {String} id
* 关闭autofit.js造成的影响
*
*/
off(id?: string): void;
/**
* 检查autofit.js是否正在运行
*/
isAutofitRunnig: boolean;
}
declare const autofit: autofit;
/**
* @param {string} el - 待处理的元素选择器
* @param {boolean} isKeepRatio - 是否保持纵横比可选默认为truefalse时将充满父元素
* @param {number|undefined} level - 缩放等级,用于手动调整缩放程度(可选,默认为 1)
*/
declare function elRectification(el: string,isKeepRatio?:boolean,level?: number): void;
export default autofit;
export { elRectification };