RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
创新互联小程序教程:微信小程序设备

微信小程序API设备概览

让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:域名注册、网页空间、营销软件、网站建设、崇义网站维护、网站推广。


  • 系统信息——(wx.getSystemInfo、wx.getSystemInfoSync)
  • 网络状态——(wx.getNetworkType)
  • 重力感应——(wx.onAccelerometerChange)
  • 罗 盘——(wx.onCompassChange)
  • 拨打电话——(wx.makePhoneCall)
  • 扫 码——(wx.scanCode)

wx.getSystemInfo(OBJECT)


获取系统信息。

OBJECT参数说明:

参数 类型 必填 说明
successFunction接口调用成功的回调
failFunction接口调用失败的回调函数
completeFunction接口调用结束的回调函数(调用成功、失败都会执行)

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)
  }
})

wx.getSystemInfoSync()


获取系统信息同步接口

示例代码:

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
}

分享标题:创新互联小程序教程:微信小程序设备
本文来源:http://www.jxjierui.cn/article/cddeejh.html