首先 获取适配器信息,用getSystemInfoSync() 然后.windowHeight 获取高度 ,.windowWindth 获取宽度。
var sysInfo = wx.getSystemInfoSync();
console.log(sysInfo);
var winHeight = sysInfo.windowHeight;
var winLength = sysInfo.windowWidth;
console.log(winHeight);
console.log(winLength);
这个运行的结果是:
我这个是iPhone6的适配,屏幕信息就console 出来了 ,高为 603 宽为375 。
关键在于 测量设备信息是用 wx.getSystemInfoSync() 。