Skip to content
On this page

uniapp-unit

uniapp 中对基础单位进行转换

Usage

js
import { rpxToPx } from '@morehook/uniapp-unit'

const pr = rpxToPx(32)

Type Declarations

typescript
/**
 * rpx转px
 */
declare const rpxToPx: (rpx: number | string) => number
/**
 * px转rpx
 */
declare const pxToRpx: (px: number | string) => number
/**
 * 获取导航栏高度 (默认转 rpx 单位)
 */
declare const getWindowTop: () => number
/**
 * 获取状态栏高度 (默认转 rpx 单位)
 */
declare const getStatusBarHeight: () => number
/**
 * 获取页面高度 (默认转 rpx 单位)
 */
declare const getWindowHeight: () => number
export { rpxToPx, pxToRpx, getWindowTop, getStatusBarHeight, getWindowHeight }

Source

SourceDocs