用getSystemInfo获取到的真机分辨率不对
发布于 6 年前 作者 tao48 11048 次浏览 来自 问答

wx.getSystemInfo({

success: this.handleGetLocationSucc.bind(this)

});

handleGetLocationSucc(res){

console.log(res);

this.data.screenWidth = res.screenWidth;

this.data.screenHeight = res.screenHeight;

console.log(this.data.screenWidth);

console.log(this.data.screenHeight);

},

用真机调试时,getSystemInfo获取的分辨率是这个

实际手机的分辨率应该1080*1920

请问各位大神,这个问题该怎么解决啊?

2 回复

返回的是PX,1920*1080是设备的物理像素   可以用px*pixelRatio(你的是2.7)求得物理像素

差不太多了

pixelRatio为2.7

2.7*400

2.7*712

回到顶部