nuke-dimensions

2.3.12 • Public • Published

Dimensions

  • category: API
  • chinese: 屏幕参数
  • type: API 能力

何时使用

由于 weex 容器不支持 height : 100% ,当你需要获取屏幕宽高的 rem 数值时并设置样式时,需要 Dimensions 组件。

API

获取尺寸: Dimensions.get('window/screen')

获取 window 或 screen 的尺寸,默认竖屏

// 获取屏幕宽高的 rem 数值
let { height, width } = Dimensions.get('window');

获取横屏属性: Dimensions.getWindowInfo(isLandscape)

isLandscape 为 true 时,返回横屏宽高。

需当前页面在容器横屏下打开,否则将出现不可预料的数值

// 获取横屏模式下宽高
let { height, width } = Dimensions.getWindowInfo(true);

其他

  • bug、建议联系 @翊晨
  • 钉钉交流群

Readme

Keywords

Package Sidebar

Install

npm i nuke-dimensions

Weekly Downloads

11

Version

2.3.12

License

Apache-2.0

Unpacked Size

26.4 kB

Total Files

10

Last publish

Collaborators

  • doub
  • fnatic
  • leanhunter