# nuke-dimensions

> 屏幕参数

Latest version **2.3.12** (published 2019-09-26) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install nuke-dimensions
pnpm add nuke-dimensions
yarn add nuke-dimensions
bun add nuke-dimensions
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.3.12 |
| Published | 2019-09-26 |
| First published | 2016-11-09 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 25.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | doub |
| Maintainers | doub, fnatic, leanhunter |
| Keywords | nuke, dimensions |

## Links

- npm: https://www.npmjs.com/package/nuke-dimensions
- Repository: git@gitlab.alibaba-inc.com:nuke/dimensions
- npm.io page: https://npm.io/package/nuke-dimensions

## Dependencies (1)

- [nuke-env](https://npm.io/package/nuke-env.md) ^2.3.12

## Recent versions

- 2.3.12 (latest) — 2019-09-26
- 2.1.3 (beta) — 2018-08-15
- 2.3.11 — 2019-09-26
- 2.3.10 — 2019-09-26
- 2.3.9 — 2019-09-26
- 2.3.8 — 2019-09-25
- 2.3.7 — 2019-07-24
- 2.3.6 — 2019-07-19
- 2.3.5 — 2019-07-02
- 2.3.4 — 2019-05-10
- 2.3.3 — 2019-04-28
- 2.3.2 — 2019-01-15
- 2.3.1 — 2019-01-15
- 2.3.0 — 2018-11-14
- 2.2.29 — 2018-10-09
- … 48 more at https://npm.io/package/nuke-dimensions/versions

## README

# Dimensions

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

---

## 何时使用

由于 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);
```

## 其他
- bug、建议联系 <a href="dingtalk://dingtalkclient/action/sendmsg?dingtalk_id=kjwo3w5">@翊晨</a>
- 钉钉交流群

<img src="https://img.alicdn.com/tfs/TB101EESpXXXXXFXpXXXXXXXXXX-1122-1362.jpg" width="260" />

---
_Source: https://npm.io/package/nuke-dimensions · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
