mgtv.getSystemInfo(Object object)
信息
框架版本 0.5.6 开始支持。
获取系统相关信息
参数
Object object
| 属性 | 类型 | 默认值 | 必填 | 说明 |
|---|---|---|---|---|
| success | function | 否 | 接口调用成功的回调函数 | |
| fail | function | 否 | 接口调用失败的回调函数 | |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
object.success 回调函数
参数
Object res
兼容问题警告: 0.21.X 版本之前返回数据在
res.data中
| 属性 | 类型 | 说明 |
|---|---|---|
| platform | string | 系统平台: Android/iOS/devtools |
| platformVersion | string | 系统平台版本 |
| pixelRatio | number | 设备的像素密度和字体缩放比 |
| windowWidth | number | 小程序窗口宽度 单位 px |
| windowHeight | number | 小程序窗口高度 单位 px |
| screenWidth | number | 屏幕宽度 单位 px |
| screenHeight | number | 屏幕高度 单位 px |
| statusBarHeight | number | 系统状态栏高度 单位 px |
| navigationBarHeight | number | 小程序导航栏高度 单位 px |
| appVersion | string | 宿主 App 系统版本 |
| SDKVersion | string | 客户端基础库版本 |
| miniAppVersion | string | 小程序包版本 |
示例代码
mgtv.getSystemInfo({
success(res) {
console.log(res.platform);
},
});