获取系统信息。
object参数说明:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| success | function | 是 | 接口调用成功的回调 |
| fail | function | 否 | 接口调用失败的回调函数 |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
success回调参数说明:
| 属性 | 说明 |
|---|---|
| model | 手机型号 |
| pixelratio | 设备像素比 |
| windowwidth | 窗口宽度 |
| windowheight | 窗口高度 |
| language | 微信设置的语言 |
| version | 微信版本号 |
| system | 操作系统版本 |
| platform | 客户端平台 |
示例代码:
wx.getsysteminfo({
success: function(res) {
console.log(res.model)
console.log(res.pixelratio)
console.log(res.windowwidth)
console.log(res.windowheight)
console.log(res.language)
console.log(res.version)
console.log(res.platform)
}
})
获取系统信息同步接口
示例代码:
try {
var res = wx.getsysteminfosync()
console.log(res.model)
console.log(res.pixelratio)
console.log(res.windowwidth)
console.log(res.windowheight)
console.log(res.language)
console.log(res.version)
console.log(res.platform)
} catch (e) {
// do something when catch error
}