systemInfo
获取系统信息。
支持
安装
$ npm install @uni/system-info --save
or
$ npm install @uni/apis --save
示例
import { getInfo, getInfoSync } from '@uni/system-info';
getInfo().then(res => console.log(res));
let res = getInfoSync();
你也可以从大包引入:
import { systemInfo } from '@uni/apis';
systemInfo.getInfo().then(res => console.log(res));
let res = systemInfo.getInfoSync();
返回
成员 | 类型 | 描述 |
---|---|---|
pixelRatio | number |
设备像素比 |
screenWidth | number |
屏幕宽度,单位px |
screenHeight | number |
屏幕高度,单位px |
windowWidth | number |
可使用窗口宽度,单位px |
windowHeight | number |
可使用窗口高度,单位px |
language | string |
设置的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文 |
version | string |
版本号 |
platform | string |
客户端平台 |