npm.io
1.0.11 • Published 3 years ago

@uni/system-info

Licence
BSD-3-Clause
Version
1.0.11
Deps
1
Size
186 kB
Vulns
0
Weekly
0
Stars
271

systemInfo

npm

获取系统信息。

支持

browser miniApp wechatMiniprogram bytedanceMicroApp baiduSmartProgram kuaiShouMiniProgram

安装

$ 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 客户端平台
微信小程序