UNPKG

@nutui/nutui-react

Version:

京东风格的轻量级移动端 React 组件库,支持一套代码生成 H5 和小程序

37 lines (36 loc) 1.42 kB
/** 原生 DongScreenAdapterPlugin.getScale 的典型返回结构 */ type NativeScaleResponse = { status?: string; data?: { scale?: number | string; }; }; /** jmfe 通用 callNative 签名 */ type NativeCaller = (plugin: string, method: string, params: string, extra: string) => Promise<NativeScaleResponse>; /** 站内容器的 jmfe 桥接方法(可选) */ declare global { interface Window { jmfe?: { callNative?: NativeCaller; }; } } /** 字体档位:标准、大字、老年 */ export type ScaleProfile = 'standard' | 'large' | 'elderly'; /** 不同场景可选用不同放大比例(layout 等默认可不额外放大) */ export type ScaleScene = 'layout' | 'font' | 'icon' | 'lego'; export type ScaleDevice = 'phone' | 'pad'; /** 首次计算缩放并订阅 resize;返回卸载函数(SSR 下为空函数) */ export declare function initScaleF(nextProfile?: ScaleProfile): () => void; /** calcByProfile 的可选覆盖项:临时指定档位、场景、scale 或设备 */ type CalcByProfileOptions = { profile?: ScaleProfile; scene?: ScaleScene; scale?: number; device?: ScaleDevice; }; /** * 按档位与场景将设计稿基准值换算为实际数值:base × 场景倍率 × 当前 scale,再按规则取整。 */ export declare function calcByProfile(baseValue: number, options?: CalcByProfileOptions): number; export {};