- 高度与宽度与实际手机相关差一点
- 两个APP 获取 的高度也不一致
程序1:14:31:43.428 mounted screenWidth:411,screenHeight798,pixelRatio2.625,width:1078.875,Height:2094.75 at App.vue:40
程序1:14:35:53.473 mounted screenWidth:411,screenHeight846,pixelRatio2.625,width:1078.875,Height:2220.75 at App.vue:66
screenHeight 不一致
实际手机分辩率: 2220X 1080(三生Note8)
求指导, 代码如下
setInterval(function() {
uni.getSystemInfo({
success: function (res) {
console.log(res.model);
console.log('pixelRatio',res.pixelRatio);
console.log('windowWidth',res.windowWidth);
console.log('windowHeight',res.windowHeight);
console.log('screenWidth',res.screenWidth);
console.log('screenHeight',res.screenHeight);
console.log("windowTop",res.windowTop);
console.log("windowBottom",res.windowBottom);
console.log(res.language);
console.log(res.version);
console.log(res.platform);
}
});
const {
screenWidth,
screenHeight,
pixelRatio
} = uni.getSystemInfoSync();
console.log("mounted screenWidth:" + screenWidth+ ",screenHeight" + screenHeight+ ",pixelRatio" + pixelRatio+ ",width:" + (pixelRatio*screenWidth)+ ",Height:" + (pixelRatio*screenHeight));
}, 1000 * 3);
2***@qq.com (作者)
和我的代码结果 一致
2022-05-19 16:37