# Dimensions

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

---

<a href="http://nuke.alibaba-inc.com/" target="_blank"> Nuke UI </a>


![nuke-dimensions@ALINPM](http://web.npm.alibaba-inc.com/badge/v/nuke-dimensions.svg?style=flat-square)  ![nuke-dimensions@ALINPM](http://web.npm.alibaba-inc.com/badge/d/nuke-dimensions.svg?style=flat-square)

## 何时使用

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



## API 


### Dimensions.get('window/screen') 

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


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


### Dimensions.getWindowInfo(isLandscape) 

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

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


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