本文实例讲述了微信小程序获取手机系统信息的方法。分享给大家供大家参考,具体如下:
& lt; view>手机型号:{{mobileModel}} & lt;/view> & lt; view>手机像素比:{{mobileePixelRatio}} & lt;/view> & lt; view>窗口宽度:{{windowWidth}} & lt;/view> & lt; view>窗口高度:{{windowHeight}} & lt;/view> & lt; view>微信设置的语言:{{语言}}& lt;/view> & lt; view>微信版本号:{{version}} & lt;/view> >之前
index.js逻辑文件代码
应用var=getApp () 页面({ 数据:{ mobileModel:”, mobileePixelRatio:”, windowWidth:”, windowHeight:”, 语言:”, 版本:“ }, onLoad:函数(){ var=这个; wx.getSystemInfo ({ 成功:函数(res) { that.setData ({ mobileModel: res.model, mobileePixelRatio: res.pixelRatio, windowWidth: res.windowWidth, windowHeight: res.windowHeight, 语言:res.language, 版本:res.version }) } }) } }) >之前这里通过wx.getSystemInfo函数来获取手机系统信息。具体参数说明与用法还可参考官网:https://mp.weixin.qq.com/debug/wxadoc/dev/api/systeminfo.html wxgetsysteminfoobject
点击此处。
希望本文所述对大家微信小程序开发有所帮助。
微信小程序获取手机系统信息的方法【附源码下载】